Even students who hate math find one calculation very useful -- what is the lowest
score I can get on the last test and pull out a certain grade? Let's
write a program to help them minimize their education.
We will assume that an average score of 90 or higher is rewarded with an A grade,
80 or higher (but less than 90) is a B, 70 or higher (but less than 80) is a C, 60 or higher (but less
than 70) is a D. All test scores
are integers between 0 and 100 inclusive and the average is NOT rounded -- for
example an average of 89.99 does NOT get you an A.
Create a class Education that contains a method minimize that is given a String desire
indicating the desired
grade and a int[] tests containing the scores on all but the final test.
The method returns the lowest possible
test score for the final test that will earn at least the desired grade. If even
a perfect score won't get the desired grade, return -1.
The desired grade will be given as a String of length 1, either "A", "B", "C", or "D".
|