Testing Class GradeBook
main function (lines 38–54) creates one object of class
GradeBook and uses each of its member functions. Line 41 creates a
GradeBook object named
myGradeBook. Lines 44–45 display the initial course name by calling the object’s
getCourseName member function. The first line of the output does not show a course name, because the object’s
courseName data member (i.e., a
string) is initially empty—by default, the initial value of a
string is the so-called empty string, i.e., a string that does not contain any characters. Nothing appears on the screen when an empty string is displayed.
Line 48 prompts the user to enter a course name. Local
nameOfCourse (declared in line 40) is set to the course name entered ...