Question: Question 2: Consider a class named memberType . Each object of memberType can hold the name of a person, member ID, and number of books

Question 2:

Consider a class named memberType. Each object of memberType can hold the name of a person, member ID, and number of books bought. Complete the member functions to perform the following operations on the objects of memberType: create a new member, modify name, show name, modify member ID, show member ID, modify number of books bought and show number of books bought. Add the appropriate constructors. Write the definitions of the member functions of memberType.

Hint: Download the provided class header file, and driver program file from the blackboard, then create class implementation file based on function porotypes in the class header file. You should not change the driver program or the class header file unless your program will not be executed.

Make sure your code provides the same output as follows:

Question 2: Consider a class named memberType. Each object of memberType can

MAIN program:

#include #include #include "memberType.h" using namespace std; int main() { string name; int num,id; memberType member1("John Smith", 100, 1); cout > id; member2.modifyMemberID(id); cout > num; member2.modifyNumBooksBought(num); cout  

MEMBERTYPE.h:

#include #include using namespace std; class memberType { private: string name; int memberID; int numBooksBought; public: void setMember(string name, int memberID, int numBooksBought); void modifyName(string name); void showName() const; void modifyMemberID(int memberID); void showMemberID() const; void modifyNumBooksBought(int numBooksBought); void showNumBooksBought() const; void print() const; memberType(); memberType(string name, int memberID, int numBooksBought); }; 
C: WINDOW Member 1: Initialized using the constructor function Name of the person: John Smith, Member ID: 100, Number of books bought: 1 Member 2: Created a new member using utility function of the class Name of the person: Robert De, Member ID: 200, Number of books bought: 2 Modify name for member 2: Peter Sam Modify member ID for member 2: 300 Modify number of books bought for member 2 5 Member 2: Updated name: Peter Sam Updated ID: 300 Updated number of books bought 5 Press any key to continue

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!