Question: (10pts) Suppose score is a double variable that stores a student's score in a class. It has been declared and initialized. ) Suppose maxscore is
(10pts) Suppose score is a double variable that stores a student's score in a class. It has been declared and initialized. ) Suppose maxscore is another double variable that has been declared and assigned by the highest score among all students in a class. Suppose grade is a char variable that has been declared. Write a nested-if-else statement to assign an appropriate letter grade to the grade variable according to the following rules: 1. If score is within 10 points of maxScore, it is a A grade. 2. Otherwise, if score is within 20 points of maxScore, it is a B grade. 3. Otherwise, if score is within 30 points of maxScore, it is a C grade. 4. Otherwise, if score is within 40 points of maxScore, it is a D grade. 5. Otherwise, it is an F grade
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
