Question
Write a program named ClassifyScores that classifies a series of scores entered by the user into ranges (0-9, 10-19, and so forth). The scores will
Write a program named ClassifyScores that classifies a series of scores entered by the user into ranges (0-9, 10-19, and so forth). The scores will be numbers between 0 and 100.
Design and implement a program to prompt the user to enter each score separately.
If the score is within the correct range, then increment the appropriate range
If the score entered is greater than 100, display an error message, ignore the incorrect score, and prompt for the user to enter the next score.
If the score entered is less than 0, the program should display the result and terminate.
For example, if the user enters 1 score between 20 and 29, 2 scores between 40 and 49, 3 scores between 50 and 59, etc. The program should display the following.
Range Number of scores
0-9 0
10-19 0
20-29 1
30-39 0
40-49 2
50-59 3
60-69 1
70-79 7
80-89 5
90-100 3
Hint: Create an array with 10 elements, one for each range. When each score is entered, increment the appropriate array element. The array index for each range can be calculated by (score / 10). Please note that when the score is 100, the appropriate array index cannot be calculated this way.
Note: The user of your program can enter as many scores as (s)he wishes. The user identifies the end by entering a negative number for score; your program then should display the tabulated scores and exit.
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