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

You will be creating a C++ program that mimics a very simple rolodex. To accompl

ID: 3661986 • Letter: Y

Question

You will be creating a C++ program that mimics a very simple rolodex. To accomplish this your program will need classes to model real world objects.
Each class will be separated into two files: a header and source file. Below are the specifications for each class:


Class Person Basics (person.h and person.cpp):
The class must be named Person
The class must have the following in private:
string firstName
string lastName
int age
int telNum
An array with a length of 10 of type Address* (Note this an array of pointers to
type Address which is described below)
int numAddrs to keep track of the number of addresses stored
Any other helper functions you wish to create
The class must have the following in public:
a default constructor
a constructor that takes arguments for each of the private data members
order of arguments: firstName, lastName, age, telNum
a destructor to handle freeing up the dynamic memory
a copy constructor that handles the array or pointers correctly
an overloaded assignment operator which copies the data from the RHS (right
hand side of the ‘=’) to the LHS (left hand side)
Mutators and accessors for each of the data members (e.g. setAge and getAge)
void displayPerson() that will display all the information about a Person including
addresses (see attached example for formatting) ***NOTE*** this function must
be called this specifically
void addAddress(Address &newAddr) that takes an existing address and adds it
to the person’s addrs array ***NOTE*** this function must be called this
specifically


Class Address Basics (address.h and address.cpp):
The class must be named Address
The class must contain the following in private:
string label
string houseNumber
string streetName
string city
string state
int zip
The class must have the following in public:
a default constructor
a constructor that takes arguments for each of the private data members
order of arguments: label, houseNumber, streetName, city, state, zip
a copy constructor
an overloaded assignment operator which copies the data from the RHS (right
hand side of the ‘=’) to the LHS (left hand side)
Mutators and accessors for each of the data members (e.g. setZip and getZip)

The names for variables and functions are up to you EXCEPT where noted. Your classes must
be named Person and Address . This is so the automatic program can use everyone’s files
without needing to be changed. This is good practice for working to specifications on a design
team.

Explanation / Answer

person.cpp

#include"person.h"
#include"address.h"

using namespace std;

class person
{
string firstName;
string lastName;
int age;
int telNum;
Address* b;
Address a[10];
b=a;
int numAddr;
public:
person();
person(string firstName, string lastName, int age, int telNum);
~person();
};


person::person()
{

}

person::person(string firstName, string lastName, int age, int telNum)
{
this->firstName=firstName;
this->lastName=lastName;
this->age=age;
this->telNum=telNum;
}
person::person(const person &objd)
{

}
person::~person()
{

}



class Address
{
string label;
string houseNumber;
string streetName;
string city;
string state;
int zip;

Address()
{

}

Address(string label, string houseNumber, string streetName, string city, string state, int zip)
{
this->label=label;
this->houseNumber=houseNumber;
this->streetName=streetName;
this->city=city;
this->state=state;
}
this->zip=zip;

};

int main()
{  


return 0;
}

person.h

#include<iostream>
#include<string>

Address.h

#include<iostream>
#include<string>

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