Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The main method below calls four other methods - namely readInput, computeAverageOfThreeScores, computeLetterGrade and printOutput. The readInput and printOutput methods have already been written. You
The main method below calls four other methods - namely readInput, computeAverageOfThreeScores, computeLetterGrade and printOutput. The readInput and printOutput methods have already been written. You are to write the other two methods that belong in the class. You will be prompted for each method and you are to write the code for each method inside the text area after the prompt. If you provide the correct response, the program should run correctly as indicated in the sample I/O sequence. Note: Your methods must make the program yield the outcome shown in the sample console I/O sequence. //---- Grader.java import java.util.Scanner; public class Grader { private int score1, score2, score3; double averageScore; private char grade; public void readInput() { Scanner kbd=new Scanner(System.in); System.out.print("Enter 3 scores between 0 and 100 each: "); score1=kbd.nextInt(); score2=kbd.nextInt(); score3=kbd.nextInt(); } //---- Write the computeAverageOfThreeScores method below. //---- Write the computeLetterGrade method below. Scale is 90+ A, 80+ B, 70+ C, 60+ D, 59- F public void printOutput() { System.out.printf("Average of %d, %d, %d is %.2f Letter grade for %.2f is %s", score1, score2, score3, averageScore, averageScore, grade); } public static void main (String args[]) { Grader g = new Grader(); g.readInput(); g.computeAverageOfThreeScores(); g.computeLetterGrade(); g.printOutput(); } }
Sample console I/O execution sequence
Enter 3 scores between 0 and 100 each: 80 60 57 Average of 80, 60, 57 is 65.67 Letter grade for 65.67 is D
Write the computeAverageOfThreeScores method below.
Write the computeLetterGrade method below. Scale is 90+ A, 80+ B, 70+ C, 60+ D, 59- F
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