The TESTER and CLASS need to be separate: Write a class and a tester that reads
ID: 3668274 • Letter: T
Question
The TESTER and CLASS need to be separate:
Write a class and a tester that reads students scores, gets the best score and then assign grades based on the following scheme:
Grade is A if score is >= best - 10;
Grade is B if score is >= best - 20;
Grade is C if score is >= best - 30;
Grade is D if score is >= best - 40;
Grade is F otherwise.
The program prompts the user for the total number of students, then prompts the user to enter all of the scores, and concludes by displaying the grades. Here is a sample run:
Enter the number of students: 4
Enter 4 scores: 40 55 70 58
Student 1 is 40 and grade is C.
Student 2 is 55 and grade is B.
Student 3 is 70 and grade is A.
Student 4 is 58 and grade is B.
Instance Fields: Array of scores, Best grade
Methods:
public void add (double score)
public String findBestGrade( )
public String findStudentGrade( )
Explanation / Answer
Output:
Enter the number of students: 4
Enter 4 scores: 40 55 70 58
Student 1 is 40 and grade is C.
Student 2 is 55 and grade is B.
Student 3 is 70 and grade is A.
Student 4 is 58 and grade is B.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.