Question: C++ Linux Need help with lab assignment. Instructions, main.cpp code below, and output example. Will need to define two new classes named: Persondata.h Customerdata.h INSTRUCTIONS:
C++ Linux
Need help with lab assignment. Instructions, main.cpp code below, and output example.
Will need to define two new classes named:
Persondata.h
Customerdata.h
INSTRUCTIONS:

CODE:
#include
#include "PersonData.h"
#include "CustomerData.h"
using namespace std;
int main() {
PersonData P1;
P1.setName("Junyi", "Tu");
P1.setAddress("1101 Camden Ave.", "Salisbury", "MD", "21801");
P1.setPhone("410-677-0027");
P1.PrintRecord();
cout
cout
cout
PersonData *P2 = new PersonData();
P2->setName("John", "Doe");
P2->setAddress("Nowhere Ave.", "Podunk", "NB", "66666");
P2->setPhone("123-456-7890");
P2->PrintRecord();
cout
cout getRecord()
cout
CustomerData *P3 = new CustomerData();
P3->setName("Jane", "Doe");
P3->setAddress("Nowhere Ct.", "Podunk", "NB", "66666");
P3->setPhone("987-798-1111");
P3->setCustomerNumber(12345);
P3->setMailingList(false);
P3->PrintRecord();
cout
cout getRecord()
cout
PersonData *costumers[5];
costumers[0] = P2;
costumers[1] = P3;
for (int i = 0; i
costumers[i]->PrintRecord();
cout
}
delete P2;
delete P3;
P2 = nullptr;
P3 = nullptr;
return 0;
}
OUTPUT:


Design a class named PersonData with the following member variables: - lastName - address state phone - firstName - city zip Write the appropriate accessor and mutator functions for these member variables. Next, design a class named CustomerData, which is derived from the PersonData class. The CustomerData class should have the following member variables: - customerNumber - mailingList The customerNumber variable will be used to hold a unique integer for each customer. The mailingList variable should be a bool. It will be set to true if the customer wishes to be on a mailing list, or false if the customer does not wish to be on a mailing list. Write appropriate accessor and mutator functions for these member variables. In particular, both classes should have the functions PrintRecord and getRecord. Neither should take any parameters. The PrintRecord will print the data to the console in a nice format, example is below. The getRecord function will return a string of the data with each field separated by a "/", example below. Also, these two functions must be set up for dynamic binding. The CustomerData class should call the PrintRecord and getRecord functions from the parent class to do its portion of the printing or string creation, you do not want to rewrite the code you already wrote for the base class. Create the following main and run it with your classes. The output is below the main code. Output: Junyi, Tu 1101 Camden Ave. Salisbury, MD 21801 410-677-0027 Junyi, Tu / 1101 Camden Ave. / Salisbury, MD 21801 / 410-677-0027 Doe, John Nowhere Ave. Podunk, NB 66666 1234567890 John Doe / Nowhere Ave. / Podunk, NB 66666 / 123-456-7890 Doe, Jane Nowhere Ct. Podunk, NB 66666 987-798-1111 Customer Number: 12345 On the Mailing List: No Jane Doe / Nowhere Ct. / Podunk, NB 66666 / 987-798-1111 / C\#: 12345 / ML: No Doe, John Nowhere Ave. Podunk, NB 66666 1234567890 Doe, Jane Nowhere Ct. Podunk, NB 66666 987-798-1111 Customer Number: 12345 On the Mailing List: No
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
