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. Save as Grades.java,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 |
Before writing the code, you will need to figure out the pattern in the mapping. May not use if and/or if/else statements. (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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started