Create a file called “grades.txt” with the following contents:
56
94
83
77
39
60
79
67
95
99
100
84
Read the data from the file into an array called grades when the program is loaded.
Then, when the button is clicked, display the number of A's, B's, C's, D's, and F's in the
list box, and show the min, max, and average.
From the given input, the output should be like the following:
Number of scores: ...
Max score: ...
Min score: ...
Average: xx.x
A’s: 4
B’s: 2
C’s: 2
D’s: 2
F’s: 2
A is for grade >=90
B is for 80 <= grade < 90
C is for 70 <= grade < 80
D is for 60 <= grade < 70
F is for grade < 60.
Note that the average should show one decimal digit. You want to use separate
functions to find the number of scores, max score, min score, the average, and the
number of each grade.
Comments
Leave a comment