Question
Modify class GradeBook (GradeBook.cpp, and GradeBook.h) (attached) as follows: a) Include a second private data member instructorName in the GradeBook class. It represents the course
Modify class GradeBook (GradeBook.cpp, and GradeBook.h) (attached) as follows:
a) Include a second private data member instructorName in the GradeBook class. It represents the course instructors name. The data type of the instructorName is a string.
b) Create a new setInstructorName function in the GradeBook class. The function sets the instructor name. It accepts a string argument and does not return anything.
c) Create a new getInstructorName function in the GradeBook class. The function retrieves the instructor name. It does not accept any argument and returns one string data.
d) Modify the constructor to accept two parametersone for the course name and one for the instructors name.
e) Modify member function displayMessage such that it will display the welcome message and course name, then outputs "This course is presented by: " followed by the instructors name.
f) Adjust all the necessary statements in the GradeBook.cpp file to display the required space(s) and line space(s).
The CISP400V10A1.exe file is an executable file. You can double click the file to get to the expecting result of this assignment. The GradeBook.h and GradeBook.cpp are bases for you for this program. So, you dont need to start from scratch but please remove all the non-related information for this assignment. The CISP400V10A1.cpp is a driver program for you to test the required assignment implementation
Put the your (modified or completed) GradeBook.h , GradeBook.cpp and CISP400V10A1.cpp(attached) file in a project you can compile the project and run to the following result. Please be awarded that you can adjust only your program (GradeBook.h , GradeBook.cpp) to generate the required result.
Please modify the following code:
// GradeBook.cpp // GradeBook member-function definitions. This file contains // implementations of the member functions prototyped in GradeBook.h. #include
// constructor initializes courseName with string supplied as argument GradeBook::GradeBook( string name ) : courseName( name ) // member initializer to initialize courseName { // empty body } // end GradeBook constructor
// function to set the course name void GradeBook::setCourseName( string name ) { courseName = name; // 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
// display a welcome message to the GradeBook user void GradeBook::displayMessage() const { // call getCourseName to get the courseName cout << "Welcome to the grade book for " << getCourseName() << "!" << endl; } // end function displayMessage
// gradebook. h file
/ GradeBook.h // GradeBook class definition. This file presents GradeBook's public // interface without revealing the implementations of GradeBook's member // functions, which are defined in GradeBook.cpp. #include
// GradeBook class definition class GradeBook { public: explicit GradeBook( std::string ); // constructor initialize courseName void setCourseName( std::string ); // sets the course name std::string getCourseName() const; // gets the course name void displayMessage() const; // displays a welcome message private: std::string courseName; // course name for this GradeBook }; // end class GradeBook
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started