Computers and Technology
Computers and Technology, 24.08.2019 08:30, sydc1215

Assume that two-dimensional arrays are used to store information about students' grades. the first is called studentscores and contains the students' numerical scores as integers. the other is studentletters and contains the corresponding letter grades as a string (i. e. "a", "b", "c", "d", or "f"). each row represents an individual student and each column a different assessment.
for example, if studentscores[0][0] contains 92, then the contents of studentletters[0][0] will contain the corresponding letter grade. in this case, the letter grade is a because the professor has used a standard grading scale. note that the professor might choose a different grading scale. do not assume scores of 90 or above are the letter grade a.
public class gradebook
{
private int[][] studentscores;
private string[][] studentletters;
// constructors not shown
// postcondition: returns −1.0 if lettergrade does not appear in studentletters
// otherwise, returns the average of all studentscores with corresponding
// studentletters values that are equal to the parameter lettergrade
public double letteraverage(string lettergrade)
{
}
// other methods not shown
}
write the method letteraverage. this method returns a double representing the average (arithmetic mean) of the student scores that correspond to a given letter grade. the method letteraverage returns −1.0 if none of the student scores corresponds to the given letter grade.
for example, given the following two-dimensional arrays:
studentscores: 96 72 84 65 89 60
78 86 75 61 85 73
studentletters: a c b d a d
b b c d b c
the method call letteraverage("b") would return the number 83.25, which is the average of the four scores that correspond to the letter grade b.
the method call letteraverage("f") would return −1.0 because none of the studentletters elements are equal to f.
complete the method letteraverage below. be sure to include the method header.

answer
Answers: 3

Similar questions

Do you know the correct answer?
Assume that two-dimensional arrays are used to store information about students' grades. the first i...

Questions in other subjects:

Konu
Mathematics, 01.03.2021 17:10