Question: JAVA PROGRAMMING Task #2 - Test Scores (revisited) You never were very pleased with the Test Scores program that you developed earlier as it was

JAVA PROGRAMMING

Task #2 - Test Scores (revisited)

You never were very pleased with the Test Scores program that you developed earlier as it was limited as to only 4 grade scores being entered. You never were very pleased with the Test Scores program that you developed earlier as it was limited as to only 4 grade scores being entered. So, you decided to write NEW program that asks the user to enter any number of test scores and calculate relevant statistics. In this version, there is no need to display the letter grade average as we did before or to display all of the grades entered. Follow the Program Requirements as stated below. The Use Cases provide samples of expected user inputs and resultant outputs.

note the following: grades being entered are integer values. The average of the grades is non-integer.

Program Requirements:

Upon start of the program, a header indicating " Grading Program" is to be displayed

For user input, prompt the user to enter a grade with a prompt that indicates the entry number (i.e., Grade #1:).

Increment that entry number for each new grade requested to be entered.

Any number of grades may be entered

As you can enter any number of scores, there needs to be an approach to end the entry of scores. To terminate the entry of scores, enter "-1".

Consider this as a sentinel for the program to conclude.

So for each prompt for grade entry, entry may be an integer value in the range of 0 to 100 or "-1"

Repetitively ask user to enter a grade as long as "-1" is NOT entered.

User input validation:

Entered grades are positive integer values.

No validation of grade range is made. Assume grades may only be in the range of 0 (zero) to 100.

No validation of a potential incorrect data entry is made (ie., misspellings, whitespace)

The program concludes with "-1" being entered and displays:

a header "Grade Statistics"

- the number of test scores that were entered

- the lowest score

- the highest score

- the average of the scores

High Level Process Flow:

WHILE

Ask the user to enter a grade

Or if a -1 sentinel value is entered, then end the program

After each grade is entered, add this to a running subtotal of grades

Increment a grade count

Determine highest grade entered

Determine lowest grade entered

END WHILE

Calculate the average

Display the results

Use Cases:

Use Case #1 with Sample Inputs and Outputs:

John's Grading Program

grade 1: 100

grade 2: 80

grade 3: 90

grade 4: -1

Grade Statistics

The number of grades entered: 3

The highest grade: 100

The lowest grade: 80

The average: 90.0

Use Case #2 with Sample Inputs and Outputs:

John's Grading Program

grade 1: -1

Grade Statistics

The number of grades entered: 0

The highest grade: 0

The lowest grade: 0

The average: 0.0

Use Case #3 with Sample Inputs and Outputs:

John's Grading Program

grade 1: 76

grade 2: -1

Grade Statistics

The number of grades entered: 1

The highest grade: 76

The lowest grade: 76

The average: 76.0

Use Case #4 with Sample Inputs and Outputs:

John's Grading Program

grade 1: 77

grade 2: 75

grade 3: -1

Grade Statistics

The number of grades entered: 2

The highest grade: 77

The lowest grade: 75

The average: 76.0

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