Question: 3.11 (Modifying Class GradeBook ) Modify class GradeBook ( Figs. 3.11 3.12 ) as follows: a) Include a second string data member that represents the

3.11 (Modifying Class GradeBook) Modify class GradeBook (Figs. 3.113.12) as follows:

a) Include a second string data member that represents the course instructors name.

b) Provide a set function to change the instructors name and a get function to retrieve it.

c) Modify the constructor to specify course name and instructor name parameters.

d) Modify function displayMessage to output the welcome message and course name, then the string This course is presented by: followed by the instructors name

3.11 (Modifying Class GradeBook) Modify class GradeBook (Figs. 3.113.12) as follows: a)

Include a second string data member that represents the course instructors name.

I believe I wrote the code correctly already to include the above modifications. But I'm not sure how to compile this I thought that the Gradebook.h file 3.11 will be saved, and then I would create another file for just the srouce code which is fig 3.12. I thought when I pressed run on the source code it would find the Gradebook.h file. Is this not correct thinking?

Here's my saved code from Gradebook.h

// Fig. 3.11: GradeBook.h // GradeBook class definition. This file presents GradeBook's public // interface without revealing the implementations of GradeBook's memeber // functions, which are defined in GradeBook.cpp.

#include // class GradeBook uses C++ standard string class

//GradeBook class definition

class GradeBook

{

public: GradeBook(std::string CourseName, std::string InstructorName); //constructor initialize courseName void setCourseName (std::string); //sets the course name std::string getCourseName(); //gets the course name void setInstructorName(std::string); //sets the instructor name std::string getInstructorName(); //gets the instructor name void displayMessage(); //display a welcome message

private: std::string CourseName; //course name for this GradeBook std::string InstructorName; //Instructor Name for this GradeBook }; //end class GradeBook

Here's my saved source code for the cpp file.

// Fig. 3.12: GradeBook.cpp //GradeBook member-function definitions. This file contains //implementations of the member functions prototyped in GradeBook.h.

#include #include "GradeBook.h" //include definitions of class GradeBook using namespace std;

// constructor initializes CourseName with string supplied as argument GradeBook::GradeBook(string CourseName, string InstructorName) { setCourseName(CourseName); setInstructorName(InstructorName); } // function to set the course name void GradeBook::setCourseName(string CourseName) { CourseName = CourseName; //store the course name in the object } //end function setCourseName //function to get the course name string GradeBook::getCourseName() const { return CourseName; //return object's CourseName } //end function getCourseName //Set InstructorName void GradeBook::setInstructorName(string InstructorName) { InstructorName = InstructorName; } //Get InstructorName string GradeBook::getInstructorName() const { return InstructorName; } //display a welcome message to the GradeBook user void GradeBook::displayMessage() const { // call getCourseName to get teh CourseName cout

When I push run with the srouce code open it gives me this error:

main.cpp:6:64: fatal error: GradeBook.h: No such file or directory compilation terminated.

I // Fig. 3.11: GradeBook.h 2 // GradeBook class definition. This file presents GradeBook's public 3 // interface without revealing the implementations of GradeBook's member 4 / functions, which are defined in GradeBook.cpp. #include // class GradeBook uses C++ standard string class 7 // GradeBook class definition 8 class GradeBook 10 public: explicit GradeBook std::string; // constructor initialize courseName void setCourseName ( std::string; // sets the course name std::string getCourseName O const; // gets the course name void displayMessageO const; // displays a welcome message 12 13 14 15 private: 16 17 // end class GradeBook std::string courseName; // course name for this GradeBook Fig. 3.11 GradeBook class definition containing function prototypes that specify the interface of the class

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!