Topics covered in this Lab: Java IDE, loops, sentinel value, incrementing variables.
Write a program that reads a series of test scores from a recent test (integers in the range 0 to 100) until a sentinel value is read. A sentinel value is the value used to determine when to stop. The program then prints the following statistics for the test scores read in:
1. Count (how many test scores were read in)
2. Sum (of all of the test scores)
3. Average (mean). Be sure this is a double to retain the precision.
4. Minimum Test score read in
5. Maximum Test score read in
Be sure your output is labeled as to what it is and easy to read.
Use the following multiple Strings for your sentinel: stop, exit.
Test your program using the following data:
72
89
100
45
78
60
34
89
93
74
/*
Comment block
*/
import java.util.Scanner;
//
// Import the class that holds the min and max integer values.
public class Lab6Loop
{
public static void main( String args [] )
{
/*
1. Initialize variables for the:
a. "count",
b. minimum,
c. maximum,
d. running sum.
2. Write a while-loop to prompt for each score:
If the score is not the exit or stop string, then
a. Count it.
b. Sum it.
c. Check to determine if it is the minimum.
d. Check to determine if it is the maximum.
4. Compute the Average. This is not part of the loop.
5. Display your results.
*/
}
}