Aaron Rose wrote:I am trying to make a method which can be called in main that calculates the average participation of a group of students.
OK, so what's the formula for calculating an average? I don't see any sign of it in your code.
Tip 1: Use meaningful names for your variables. Names like '
nn' really don't tell you (or us) very much, and will only confuse you when you're trying to debug.
Tip 2:
if (n == 0) b = "reading";
if (n == 1) b = "talking";
...
forces the JVM to check '
n' as many times as you have
if statements,
regardless of the outcome. Either add an
else in front of all subsequent ones, or have a look at the
switch statement (or indeed, just
return the value as soon as you know it's the one you want).
Tip 3: Take Campbell's advice and
StopCoding (←click). The fact is that
you should never have got this far without
knowing that your code works.
HIH
Winston