Question: In a class named Grades, write a method named grade that accepts an integer parameter representing a student's course grade from 0 to 100 and
In a class named Grades, write a method named grade that accepts an integer parameter representing a student's course grade from 0 to 100 and returns the student's course grade on the 4.0 scale. Use the following mapping:
| Score | <=60 | 61 | 62 | 63 | ... | 98 | 99 | 100 |
|---|---|---|---|---|---|---|---|---|
| Grade | 0.0 | 0.1 | 0.2 | 0.3 | ... | 3.8 | 3.9 | 4.0 |
(Note: This mapping is fictional and does not represent how we will assign actual grades in this course!) Before writing the code, you will need to figure out the pattern in the mapping. Your code should only use concepts covered in Chapters 1 - 3. (HINT: Math.max or Math.min may be helpful to you)
Your class should also include a main method with tests of the grade method. Example expected return values for certain score parameters:
Parameter = 0, Return value = 0.0 Parameter = 45, Return value = 0.0 Parameter = 60, Return value = 0.0 Parameter = 63, Return value = 0.3 Parameter = 80, Return value = 2.0 Parameter = 90, Return value = 3.0 Parameter = 95, Return value = 3.5 Parameter = 100, Return value = 4.0
Reminders
All submitted code should follow the Style Guidelines and include proper Javadoc.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
