Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Making a condo management program in c++ with the following options on the menu. There are 5 options. Add record which will ask for the

Making a condo management program in c++ with the following options on the menu.

There are 5 options. Add record which will ask for the type of resident to be inputted whether it is Elderly or Adult. Which should access the appropriate class for the specific type. Then it will ask for the Name and Unit such as "Jay 12" Jay in unit 12.

Option 2 is a list record which is what I'm having issues with after I sorted out my classes. Option 2 is supposed to list all records that have been inputted by both classes into the Units list. Now I get the error listed below.

Option 3 modifies a record, the same thing as option one can be done as its functionality can overwrite an entry in the list.

Option 4 is supposed to delete a specific unit and leave its entry as blank "" its required input will simply be the unit number, not quite sure how to do that.

and Finally option 5 is supposed to quit the code when q is typed in.

Any help would be appreciated pretty stuck on this. Please leave comments if you add or change anything so I can understand further. Thanks!

#include #include using namespace std;

class AdultResidents { protected: string name = ""; int unit; public:

void getResident(string x, int y) { this -> name = x; this -> unit = y;

} virtual void printResident(void) { if (this -> name != "") cout name unit

};

class ElderResidents: public AdultResidents { public: ElderResidents(); void printResident(void) { cout name unit

int main() { int entries; string name; int unit; int option; bool menu= true; bool condo = true; string type; AdultResidents *Units[120]; while (condo == true){ if (menu == true){ cout > option;

if (option == 1){ cout> type; cout > name >> unit; if (type == "Adult"){ Units[unit]->getResident(name, unit); Units[unit]->printResident(); menu = true; } if (type == "Elderly"){ AdultResidents *pElder = new ElderResidents(); Units[unit] = pElder; Units[unit]->getResident(name, unit); Units[unit]->printResident(); menu = true; } } if (option == 2){ for(AdultResidents* unit: Units){ unit->printResident(); } menu = true; } }

}

image text in transcribed

image text in transcribedimage text in transcribed

/tmp/ccErNZio.o: In function `main': main.cpp:(.text+0x24f): undefined reference to `ElderResidents::ElderResidents()' collect2: error: ld returned 1 exit status Pick An Option 1.Add Record 2.List Record 3. Modify Record 4. Delete Record Q.Quit Enter type of resident (Elderly, Adult) Adult Enter residents name and unit number (resident unit) : Jay 12|| Pick An Option 1.Add Record 2.List Record 3. Modify Record 4. Delete Record Q.Quit

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

Students also viewed these Databases questions