I got this to compile but in the interaction pane im trying to make it look like the picture below but i come out with 0, 1 , 2, 55.8. Thanks
Attachment 1336
HTML Code:public class TestScores
{
private double[] scores;
public TestScores(double [] newScores)
{
scores = new double[newScores.length];
for (int i = 0; i < newScores.length; i++)
{
scores[i] = newScores[i];
}
}
public double getAverage()
{
double average = 0.0;
double total = 0.0;
for (double val : scores)
{
total += val;
}
average = total / scores.length;
return average;
}
public String toString(){
String str = "";
for(int i = 0; i < scores.length; i++)
{
str += i + " ";
}
str += scores[scores.length];
return str;
}
}

