Answered step by step
Verified Expert Solution
Question
1 Approved Answer
/**** Consider the TestScores program below. * TestScores.java * Dean & Dean * This implements an algorithm that averages test scores. import java.util.Scanner; public
/**** Consider the TestScores program below. * TestScores.java * Dean & Dean * This implements an algorithm that averages test scores. import java.util.Scanner; public class TestScores [ public static void main(String[] args) [ Scanner stdin = new Scanner(System.in); int score; int scoreSum = 0; int count = 0; double average = 0; System.out.print("Enter score (-1 to quit): "); score = stdin.nextInt(); while (score >= 0) [ Activate Go to Sett scoreSum + score: count++; average (double) scoreSum / count: = System.out.print ("Enter score (-1 to quit): "); score stdin.nextInt(); System.out.println("Average score is " + average); } // end main } // end Test Scores class In the above program, note how the following lines appear above the loop and also at the bottom of the loop: System.out.print("Enter score (-1 to quit): "); score stdin.nextInt(); Modify the program so it avoids having those lines appear twice but keeps the same functionality. For your modification, you are required to use a boolean variable named done in the while loop's condition. 10. [afte Act Got
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