Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help with each of these following steps (2-6). I have already posted this question 3 times now. I already have this code: #include using

Please help with each of these following steps (2-6). I have already posted this question 3 times now.

image text in transcribed

I already have this code:

#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() {

return 0; }

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database And SQL

Authors: Lucy Scott

3rd Edition

1087899699, 978-1087899695

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago