Question: public class LetterGrade{String name = ;public static void main(String[] args){calculateAvg();printLetter(88);}public static double calculateAvg() //This method will be used to calculate theaverage of the user{Scanner

public class LetterGrade{String name = " ";public static void main(String[] args){calculateAvg();printLetter(88);}public static double calculateAvg() //This method will be used to calculate theaverage of the user{Scanner console = new Scanner(System.in);double total = 0;System.out.print("Please enter your name: ");String name = console.nextLine();System.out.println("Please enter 3 scores");for(int i = 1; i <= 3; i++) //for loop for the 3 scores inserted{System.out.print("Enter score: ");double score = console.nextDouble();total = total + score;}double avg = total / 3;System.out.printf("%s, your average score is: %.2f ",name, avg);return avg;}public static void printLetter(double avg) //this method will give the lettergrade based on the students average{char letterGrade = ' ';if(avg < 100 && avg >= 90){letterGrade = 'A';}else if(avg <= 89 && avg >= 80){letterGrade = 'B';}else if(avg <= 79 && avg >= 70){letterGrade = 'C';}else if(avg <= 69 && avg >= 60){letterGrade = 'D';} else if (avg <= 59 && avg >= 0){letterGrade = 'F';}System.out.printf("Your letter grade is %s", letterGrade);}}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!