I need help with some methods in my constructor class.
My first method receives scores, computes test totals, stores them in an array and returns them.
public int[] computeStudentTotals (int[][] scores)
{
}
My next method computes grades. It invokes the computeStudentTotals method to compute the totals of three tests and store them in an array.
public void computeGrades (int[][] scores, char[] grades)
{
}
This is my 1D array for computeGrades. I would like to use a similar format in my 2D array method.
public void computeGrades (int[] scores,char[] grades)
{
for (int i = 0; i < scores.length; i++)
grades [i] = findGrade (scores[i]);
}
This is my findGrade method. It works just fine. I am displaying it as a reference.
public char findGrade (int score)
{
char g;
switch (score / 10)
{
case 10:
g = 'A';
break;
case 9:
g = 'A';
break;
case 8:
g = 'B';
break;
case 7:
g = 'C';
break;
case 6:
g = 'D';
break;
default:
g = 'F';
}
return g;
}
This is an example of what I am working with as far as scores:
David 11 12 13
Viktor 51 52 53 60 60 60
James 100 100 100
William 90 90 90
Michael 80 80 80
Giacomo 70 70 70
Ruchita 60 60 60
Jeremy 99 99 99
Kishan 88 88 88
Lebron 77 77 77
Sheena 66 66 66
Nicholas 55 55 55
Jack 100 100 100