Question: MODIFY THE PROGRAM BELOW AND ADD... apply a while loop to repeat your program as the user wants, counters, accumulators, input validation (using a while

MODIFY THE PROGRAM BELOW AND ADD... apply a while loop to repeat your program as the user wants, counters, accumulators, input validation (using a while loop)

/*/*/*/PROGRAM BELOW/*/*/*/*/

import java.util.*; public class TestAverage { public static void main(String[] args) { // declaring variables String firstname, mi, lastname; // for average double avg=0; // for Test Scores double score1,score2,score3; // accept input from the user Scanner input = new Scanner(System.in); System.out.print("Enter your first name :"); firstname = input.nextLine(); System.out.print("Enter your middle initial :"); mi = input.nextLine(); System.out.print("Enter your last name :"); lastname = input.nextLine(); // accept scores System.out.print(" Enter test score 1 :"); score1 = input.nextInt(); System.out.print("Enter test score 2 :"); score2 = input.nextInt(); System.out.print("Enter test score 3 :"); score3 = input.nextInt(); // calculate Test Average avg = (score1 + score2 + score3)/3; // print the name of the student System.out.println(" Student Name : "+(firstname+" "+mi+" "+lastname)); // printing the average System.out.printf("Average is : %.2f",avg); } }

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 Databases Questions!