Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions