Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How to code this based on the info given: Note: I\'m a beginner of C++ and I\'m

ID: 3654819 • Letter: H

Question

How to code this based on the info given:

Note: I'm a beginner of C++ and I'm just learning it, so please don't make this too advanced. I would greatly appreciate it.

1.Create a header file containing a class called memberType. Create the following pubic prototypes :

void setMemberInfo(string ID, string fName, string lName,

int bPurchased, double amount)

void setMemberID(string)

void setName(string, string)

bool isMemberID(string) const

int getBooksPurchased() const

double getTotalAmountSpent() const

void purchaseBook(double amount)

void resetbooksBoughtAndAmount()

void printMemberID() const

void printName() const

void printInfo() const

Be sure to add constructors.

Define private member variables :

string memberID

string firstName

string lastName

int booksPurchased

double amountSpent

2. Create implementation file containing function definitions :

a. The functions with

Explanation / Answer

//broken up ///////////////////////////////////////////////////// //memberType.h ///////////////////////////////////////////////////// #ifndef MEMBERTYPE_H #define MEMBERTYPE_H #include #include using namespace std; class memberType{ string memberID; string firstName; string lastName; int booksPurchased; double amountSpent; public: //prototype memberType(); memberType(string ID, string fName, string lName,int bPurchased, double amount); //mutators void setMemberInfo(string ID, string fName, string lName,int bPurchased, double amount); void setMemberID(string); void setName(string, string); //accessor bool isMemberID(string) const; int getBooksPurchased() const; double getTotalAmountSpent() const; //fxn, methods void purchaseBook(double amount); void resetbooksBoughtAndAmount(); void printMemberID() const; void printName() const; void printInfo() const; };//end of class #endif ///////////////////////////////////////////////////// //memberType.cpp ///////////////////////////////////////////////////// #include #include #include"member.h" using namespace std; memberType::memberType(){ memberID="0"; firstName="First"; lastName="Last"; booksPurchased=0; amountSpent=0; } memberType::memberType(string ID, string fName, string lName,int bPurchased, double amount){ memberID=ID; firstName=fName; lastName=lName; booksPurchased=bPurchased; amountSpent=amount; } //mutators void memberType::setMemberInfo(string ID, string fName, string lName,int bPurchased, double amount){ memberID=ID; firstName=fName; lastName=lName; booksPurchased=bPurchased; amountSpent=amount; } void memberType::setMemberID(string ID){memberID=ID;} void memberType::setName(string fName, string lName){firstName=fName; lastName=lName;} bool memberType::isMemberID(string ID) const{ return(memberID==ID); //returns 1 for true, 0 for false } //accessor int memberType::getBooksPurchased() const{return booksPurchased;} double memberType::getTotalAmountSpent() const{return amountSpent;} //fxn, methods void memberType::purchaseBook(double amount){ booksPurchased++;//add 1 amountSpent+=amount; //add amount to amountSpent } void memberType::resetbooksBoughtAndAmount(){//initializes booksPurchased and amountSpent to zero. booksPurchased=0; amountSpent=0; } void memberType::printMemberID() const{ cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote