GradeBook Class with switch Statement to Count A, B, C, D and F Grades
This next version of the
GradeBook class asks the user to enter a set of letter grades, then displays a summary of the number of students who received each grade. The class uses a
switch to determine whether each grade entered is an A, B, C, D or F and to increment the appropriate grade counter. Class
GradeBook is defined in Fig. 5.9, and its member-function definitions appear in Fig. 5.10. Figure 5.11 shows sample inputs and outputs of the
main program that uses class
GradeBook to process a set of grades.
1 // Fig. 5.9: GradeBook.h 2 // GradeBook class definition that counts letter grades. 3 // Member functions are defined in GradeBook.cpp ...