subject

Assume that two arrays are used to store information about students’ grades. One array contains the students' numerical scores (integers in the range 0 …100). The other array contains the corresponding letter grades (Strings having possible values of "A", "B", "C", "D", and "F"). For example, if studentScores[0] contains 92, then studentLetters[0] will contain the corresponding letter grade for 92, which is "A" if the professor is using a standard grading scale. Note that the professor might choose a different grading scale, so if one is looking for A grades, one should look in the studentLetters array for values of "A", and not in the studentScores array for values of 90 and above.

public class Gradebook
{

private int[] studentScores;

private String[] studentLetters;

// postcondition: returns -1.0 if letterGrade does not appear in studentLetters

// otherwise, returns average of all studentScores[n],

// for all 0 <= n < studentScores. length, such that

// studentLetters[n] is equal to letterGrade

public double letterAverage(String letterGrade)

{

}

}

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. LetterAverage returns -1.0 if none of the student scores corresponds to the given letter grade.

For example, given the following arrays:
studentScores: 96 72 84 65 89 60 78 86 75 61 85
studentLetters: A C B D A D B B C D B
letterAverage("B") would return the number 83.25, which is the average of the four scores that correspond to the letter grade B.
letterAverage("A") would return the number 92.5, which is the average of the four scores that correspond to the letter grade A.
letterAverage("F") would return -1.0, because no scores are below 60.
Note that the professor might choose a different grading scale, so if one is looking for A grades, one should look in the studentLetters array for values of "A", and not in the studentScores array for values of 90 and above.
Complete method letterAverage below:

// postcondition: returns -1.0 if letterGrade does not appear in studentLetters

// otherwise, returns average of all studentScores[n],

// for all 0 <= n < studentScores. length, such that

// studentLetters[n] is equal to letterGrade

public double letterAverage(String letterGrade)

{

}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:40
When running anti-virus software , what could be a reason where recipitent is not guaranteed that data being streamed will not get interrupted?
Answers: 1
question
Computers and Technology, 23.06.2019 09:00
Before you record your own voice, you should a. record other people's voices b. warm up and practice difficult names c. listen to your favorite songs d. read a transcript of a good radio news segment
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
Alison is having a hard time at work because hee inbox is flooded with emails every day. some of these emails are unsolicited. some of other she don’t need. which action should she take to better manager her emails?
Answers: 1
question
Computers and Technology, 24.06.2019 22:00
Is the process of organizing data to reduce redundancy. a. normalization b. primary keying c. specifying relationships d. duplication
Answers: 1
You know the right answer?
Assume that two arrays are used to store information about students’ grades. One array contains the...
Questions
question
Mathematics, 06.11.2021 01:30
question
Biology, 06.11.2021 01:30
question
Mathematics, 06.11.2021 01:30
Questions on the website: 13722362