Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE I NEED HELP modifying this Vector address book program by creating a Person Class, an Employer Class and a Personal Info Class. Using the

PLEASE I NEED HELP modifying this Vector address book program by creating a Person Class, an Employer Class and a Personal Info Class. Using the Employer and Personal Info classes as member variables of a Person class. Modify the Vector class to hold People objects instead of Record objects. Modify the menu interface and input algorithms to accept data for the Employer and Personal Info classes via functions in the Person class. Modify the Output to print all the information in each Person object, associated Employer object, and associated Personal Info object.

addressBook.cpp

#include

#include

#include

#include

#include "addressBook.h"

using namespace std;

int main()

{

vector addressBook;

int counter = 0;

std::string fname, lname;

int age, op = 0;

long int phoneNum;

while (1)

{

cout << "1.Enter info 2.Display info 3.Exit ";

cin >> op;

switch (op)

{

case 1:

{

cout << "First Name :";

cin >> fname;

cout << "Last Name :";

cin >> lname;

cout << "Age :";

cin >> age;

cout << "Phone Number :";

cin >> phoneNum;

AddressBook temp_addr;

temp_addr.setFname(fname);

temp_addr.setLname(lname);

temp_addr.setAge(age);

temp_addr.setTelNum(phoneNum);

addressBook.push_back(temp_addr);

counter++;

}

break;

case 2:

for (int i = 0; i < counter; i++)

{

cout << addressBook[i].getFname();

cout << " " << addressBook[i].getLname();

cout << " " << addressBook[i].getAge();

cout << " " << addressBook[i].getTelNum();

cout << endl;

}

break;

case 3:

exit(1);

break;

}

}

}

addressBook.h

#include

using namespace std;

class AddressBook

{

private:

string fname;

string lname;

int age;

long int phoneNum;

public:

void setFname(string fname)

{

this->fname = fname;

}

void setLname(string lname)

{

this->lname = lname;

}

void setAge(int age)

{

this->age = age;

}

void setTelNum(long int phoneNum)

{

this->phoneNum = phoneNum;

}

string getFname()

{

return fname;

}

string getLname()

{

return lname;

}

int getAge()

{

return age;

}

long int getTelNum()

{

return phoneNum;

}

};

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

Database Processing

Authors: David J. Auer David M. Kroenke

13th Edition

B01366W6DS, 978-0133058352

More Books

Students also viewed these Databases questions

Question

u = 5 j , v = 6 i Find the angle between the vectors.

Answered: 1 week ago

Question

2. Identify issues/causes for the apparent conflict.

Answered: 1 week ago