Define a public Static method 'printGrade' with return type as 'void' in class 'ProblemSolution' and invoke it in the 'main' method. The 'printGrade' method will get the parameter 'score' with type double and then print out the appropriate score char, e.g. 'A', 'B' or 'C' (Hint: use if-else
Define a public Static method 'printGrade' with return type as 'void' in class 'ProblemSolution' and invoke it in the 'main' method. The 'printGrade' method will get the parameter 'score' with type double and
then print out the appropriate score char, e.g. 'A', 'B' or 'C' (Hint: use if-else).
When score >= 90.0 ---> print out 'A'
When 80.0 <= score < 90.0 ---> print out 'B'
When 70.0 <= score < 80.0 ---> print out 'C'
When 60.0 <= score < 70.0 ---> print out 'D'
When score is < 60.0 ---> print out 'F'
Then, inside the 'main' method.
The first line call the 'printGrade' method and put the parameter value 78.5.
The second line call the 'printGrade' method and put the parameter value 59.5.
Output
C
F
Where,
There should not be any space after the word.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images