← Back to Classes
Question 315
Student Letter Grade Class
Student Letter Grade Class
Create a class named Student that stores three integer test scores (math, science, and english) in three fields. Give it a constructor that takes math, science, and english (in that order). Add a method Average() that returns the integer average of the three scores using integer division ((math + science + english) / 3). Add a method Grade() that returns a letter: "A" if the average is 90 or more, "B" if 80 or more, "C" if 70 or more, otherwise "F". The runner code will create a Student and print Grade(). All test cases use scores whose sum divides evenly by 3.
Expected Output:
A= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
Classes
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cw, cr, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.