Question
Design a class memberType: Each object of memberType can hold the name of a person, member ID, number of books bought, and amount spent. Include
Design a class memberType: Each object of memberType can hold the name of a person, member ID, number of books bought, and amount spent. Include the member functions to perform the various operations on the objects of memberType such as modify, set, and show a person's name. Similarly, update, modify, and show the number of books bought and the amount spent. Add the appropriate constructors. Write the definitions of the member functions of memberType. Write a program to test various operations of your class memberType.
This needs to be done using C++. Here is what I have so far:
//memberType.h #include #include using namespace std; class memberType { public: void setMemberID(string); void setName(string, string); void printMemberID() const; void printName() const;
memberType(); private: string memberID; string firstName; string lastName; };
//memberTypeImp.cpp #include "memberType.h" #include #include using namespace std;
void memberType::setMemberID(string ID) { memberID = ID; } void memberType::setName(string fName, string lName) { firstName = fName; lastName = lName; } void memberType::printMemberID() const { cout << "Member ID: " << memberID << endl; } void memberType::printName() const { cout << "Name: " << firstName << " " << lastName << endl; } memberType::memberType() { memberID = ""; firstName = ""; lastName = ""; }
//memberType.cpp #include "memberType.h" #include
int main() {
return 0; }
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