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, 24.06.2019 19:50
How to unblock on chrome book? ?
Answers: 1
question
Computers and Technology, 24.06.2019 23:30
Does anyone have the problem where you try to watch a video to get your answer but it brings up a thing asking your gender to make ads relevant but it doesn't load? btw i won't be able to see the answer so use the comments .
Answers: 1
question
Computers and Technology, 24.06.2019 23:30
What is the opening page of a website called? a. web page b. landing page c. homepage d. opening page
Answers: 1
question
Computers and Technology, 24.06.2019 23:50
Which career involves analyzing various factors that influence the customer decision-making process? analyze various factors that influence the customer decision-making processes. reset next
Answers: 2
You know the right answer?
Assume that two arrays are used to store information about students’ grades. One array contains the...
Questions
question
English, 27.08.2019 18:50
question
Mathematics, 27.08.2019 18:50
question
Geography, 27.08.2019 18:50
Questions on the website: 13722360