Question: ( Name this program StuPreInputStats ) Write a program that takes any number of non - negative integers as input, and output statistics on the

(Name this program StuPreInputStats) Write a program that takes any number of non-negative
integers as input, and output statistics on the data. A negative integer ends the input and is not
included in the statistics. The numbers are ratings on a recently released video game and should be in
the range of [0,5]. Assume there will be at least one rating input. The statistics generated by the
program should include the total number of ratings entered, and the number and percentage of each
of the following types of ratings:
Liked: rating is 4 or 5
Neutral: rating is 3
Disliked: rating is in 0 ~ 2
Invalid: >5. Invalid data may exist due to input errors.
Here is a sample run of this program (green italic text indicates user input):
Please enter the ratings (end with a negative value):
451034654734542-2
Total # of ratings: 15
Positive ratings (4~5): 8(53%)
Neutral ratings (3): 2(13%)
Negative ratings (0~2): 3(20%)
Invalid ratings (>5): 2(13%)
Another sample run with data entered one at a line:
Please enter the ratings (end with a negative value):
4
5
1
0
3
4
6
5
4
7
3
4

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