Question: Write a java program that consists of a class named ExerciseI2 with the following: The class variable: static Scanner scan; the method main , the
Write a java program that consists of a class named ExerciseI2 with the following:
The class variable: static Scanner scan;
the method main,
the class (static) method double [ ] readTestScores( int size ),
The instance method char getLetterGrade(double score),
The class (static) method void printComment(char grade), and
The instance method void printTestResults(double [ ] testList).
Method readTestScores( int size ) receives a positive integer value n as argument, read (using the Scanner object scan) n test scores into an array and then returns that array.
Method getLetterGrade(double score) receives a students score as a value parameter, determines the corresponding letter grades, and returns it to the calling method. The letter grade is determined as follows:
if:
score >= 90 A
80 <= score < 90 B
70 <= score < 80 C
60 <= score < 70 D
score < 60 F
Method printComment(char grade) receives a students letter grade as a value parameter and prints the corresponding comment. The comment is determined as follows:
A very good
B good
C satisfactory
D need improvement
F poor
Method printTestResults(double [ ] testList) receives an array of test scores and prints a table with three columns consisting a test score in the first column, the corresponding letter grade in the second column and the corresponding comment in the third column as follows:
Test Score Letter Grade Comment
The letter grade is determined by calling the method getLetterGrade( ) and the comment is determined by calling the method printComment( ).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
