Question: Generate a text-based histogram for a sequence of grades to a class of students. The grades are [A- D, F]. Write a program that allows

 Generate a text-based histogram for a sequence of grades to a

Generate a text-based histogram for a sequence of grades to a class of students. The grades are [A- D, F]. Write a program that allows the user to enter grades of students in upper/lower case. As the grades are being entered, the program should count, using an array, the number of A's, the number of B's, the number of C's, the number of D's, and the number of F's. The program should be capable of handling an arbitrary number of student grades. However, the input should end when an invalid grade is encountered. To design your counters, use an array of size 5 where each array element is initialized to zero. Whenever an A or a is entered, increment array[0]. Whenever a B or b is entered, increment array[1], etc. up to array[4]. Output the histogram count and the barchart too as shown below.

Chapter # 8 (Arrays) Problem 1 1. Histogram Generate a text-based histogram for a sequence of grades to a class of students. The grades are l['A D', 'F']. Write a program that allows the user to enter grades of students in upperlower case. As the grades are being entered, the program should count, using an array, the number of A's, the number of B's, the number of C's, the number of D's, and the number of F's. The program should be capable of handling an arbitrary number of student grades. However, the input should end when an invalid grade is encountered. To desien your counters, use an array of size 5 where each array element is initialized to zero, whenever an 'A" ora' is entered, increment array[O], whenever a or 'b' is entered, increment array[1], etc. up to array 4]. Output the histogram count and the bar- chart too as shown below Sample input/output Enter sequence of valid grade ['A'-F' ending with an invalid grade to stop: grade(s) of A bar-chart: grade(s) of B bar-chart grade(s) of C; bar-chart:** grade(s) of Dbar-chart: grade(s) of Fbar-chart: Enter sequence of valid grade ['A-F'] ending with an invalid grade to stop: cdfdbbBBAcDffFFFp grade(s) of A bar-chart:** grade(s) of B bar-chart: grade(s) of C bar-chart: grade(s) of D bar-chart: grade(s) of F bar-chart

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