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   

for 2D array simply use something like this

public void computeGrades (int[][] scores, char[] grades)
    {
        for(int i=0;i<scores.length;i++) {
            for(j=0;j<scores[i].length;j++ {
                //your calculation here
            }
        }
    }

or better yet, start with stating what your actual question is ..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.