Question: STARTING CODE IN C++: #include using namespace std; const double BASIC_RATE = 28.50; const double PREMIUM_RATE = 60.00; struct Member { static int total_visits; static
STARTING CODE IN C++:
#include using namespace std;
const double BASIC_RATE = 28.50; const double PREMIUM_RATE = 60.00;
struct Member { static int total_visits; static int active_members; static int last_id; int id; string name; char type; int visits; Member(string name, char type) { last_id = id; last_id += 1; active_members += 1; this->name = name; this->type = type; } ~Member() { active_members -= 1; } };
int Member::total_visits = 0; int Member::active_members = 0; int Member::last_id = 100000;
void visit(struct Member *m) { m->visits += 1; m->total_visits += 1; }
int main() { //get user input int userInput; cout > userInput;
//create a Numbers object with the input Numbers num(userInput);
//print the English description num.print(); return 0; }
DIRECTIONS:
THAT IS THE STARTING CODE UP THERE
NOW ADD A MAIN FILE WITH THESE DIRECTIONS

2. In main (which can go in the same file as the Member struct): Create a vector of pointers to Member structures. Create a Member object using the new operator and add pointers to the following Member objects to the vector: Member Type P P Oprah Winfrey Fluffy Iglesias Charlie Sheen Bill Gates B B 3. Drop the membership for Charlie Sheen. delete the pointer to Charlie's Member object from the vector delete Charlie's Member object from the heap. 4. For each of the three remaining members: o generate a random number between 5 and 20. o call the visit function for that member that many times 5. When done, print a nicely-formatted columnar report which loops through the vector printing for each member: o the member's id o the member's name o the number of visits o the monthly rate for the member (type = 'B' use the basic rate of $28.50, 'P' use the premium rate of $60.00). 6. At the bottom of the report, use the static variables to show the total visit for the gym and the number of active members (should be 3). 2. In main (which can go in the same file as the Member struct): Create a vector of pointers to Member structures. Create a Member object using the new operator and add pointers to the following Member objects to the vector: Member Type P P Oprah Winfrey Fluffy Iglesias Charlie Sheen Bill Gates B B 3. Drop the membership for Charlie Sheen. delete the pointer to Charlie's Member object from the vector delete Charlie's Member object from the heap. 4. For each of the three remaining members: o generate a random number between 5 and 20. o call the visit function for that member that many times 5. When done, print a nicely-formatted columnar report which loops through the vector printing for each member: o the member's id o the member's name o the number of visits o the monthly rate for the member (type = 'B' use the basic rate of $28.50, 'P' use the premium rate of $60.00). 6. At the bottom of the report, use the static variables to show the total visit for the gym and the number of active members (should be 3)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
