Question: import java.util.Scanner; public class User Test Average public static void main(String[] args) K { Scanner sc = new Scanner(System.in); System.out.print(Enter your first name: );
![import java.util.Scanner; public class User Test Average public static void main(String[] args)](https://s3.amazonaws.com/si.experts.images/answers/2024/05/66509e74df410_47666509e74b8512.jpg)
import java.util.Scanner; public class User Test Average public static void main(String[] args) K { Scanner sc = new Scanner(System.in); System.out.print("Enter your first name: "); String firstName = sc.nextLine(); System.out.print("Enter your last name: "); String lastName = sc.nextLine(); System.out.print ("Do you want to enter your test scores? (y/n)"); char question = sc.next().charAt(0); while (question == 'y') { System.out.print ("How many tests do you want to take the average of: "); int numberOfTests = sc.nextInt(); int sum = 0; for (int i = 0; i < numberOfTests; i++) { } System.out.print("Enter your test score: "); int testScore = sc.nextInt(); sum += testScore; int avg = sum/numberOfTests; char grade; if (avg >= 90 ) { grade 'A'; }else if (avg = 80) { grade = 'B'; }else if (avg = 70) { grade 'C'; }else if (avg = 60) { grade 'D'; }else{ grade = 'F'; } System.out.println(firstName.charAt(0) + ""lastName + "and you average is " + avg + with the letter grade System.out.print ("Do you want to take the average of more tests?"); +grade + ". Your test scores are " + testScore + "."); question sc.next().charAt(0); Bluel: Terminal Window ChapterFourProject Options Enter your first name: Christian Enter your last name: Sanchez Do you want to enter your test scores? (y/n)y How many tests do you want to take the average of: 4 Enter your test score: 70 Enter your test score: 80 Enter your test score: 90 Enter your test score: 100 C Sanchez and you average is 85 with the letter grade B. Your test scores are. Do you want to take the average of more tests?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
