To be done in C++ Please Include an output screenshot! I will rate your answer i
ID: 3835162 • Letter: T
Question
To be done in C++ Please Include an output screenshot!
I will rate your answer if it works correctly!
1. Person Data L10 marks] Step 1 Person Data, CustomerData [12 marks] Design a class named PersonDatawwith the following member variables lastName firstName address city state Zip phone 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 CustomeDatam class should have the following member variables: customerNumber mailing List 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. Demonstrate an object of the CustomerData class in a simple program. Sample output Customer #1 Last Name: Smith First Name: Joan Address: 123 M Street ain City: Smithville State: NC ZIP: 99999 customer Number: 12345 Mailing List Yes Customer 2 Last Name: Jones First Name: Jenny Address: 555East Street City: Jonesville State: VA ZIP: 88888 Customer Number 77777 Mailing List? NoExplanation / Answer
#include <iostream>
#include <stdio.h>
#include <stdbool.h>
#include <cstdlib>
using namespace std;
class Person_Data
{
public:
char lastName[20], firstName[20], address[20], city[20], state[10];
int zip, phone;
void getData()
{
cout<<" Enter Last Name:";
cin>>lastName;
cout<<" Enter First Name:";
cin>>firstName;
cout<<" Enter Address:";
cin>>address;
cout<<" Enter City:" ;
cin>>city;
cout<<" Enter State:";
cin>>state;
cout<<" Enter Zipcode:";
cin>>zip;
cout<<" Enter Phone Number:";
cin>>phone;
}
void putData()
{
cout<<" Last Name:" <<lastName <<endl;
cout<<" First Name:" <<firstName <<endl;
cout<<" Address:" <<address <<endl;
cout<<" City:" <<city <<endl;
cout<<" State:" <<state <<endl;
cout<<" Zipcode:" <<zip <<endl;
cout<<" Phone Number:" <<phone <<endl;
}
};
class Customer_Data : public Person_Data
{
public:
int customerNumber;
bool mailingList;
void getdata()
{
cout<<" Enter Customer Number:";
cin>>customerNumber;
cout<<" Enter Mailing List:";
cin>>mailingList;
}
void putdata()
{
cout<<" Customer Number:" <<customerNumber <<endl;
cout<<" Mailing List:";
if(mailingList == true)
{
cout<<"Yes";
}
else
{
cout<<"No";
}
}
};
int main()
{
Customer_Data customer;
customer.getData();
customer.getdata();
customer.putData();
customer.putdata();
return 0;
}
OUTPUT
Enter Last Name: Margaratte
Enter First Name: Sophia
Enter Address: 5thstreet
Enter City: Kottayam
Enter State: Kerala
Enter Zipcode: 658789
Enter Phone Number: 123456789
Enter Customer Number: 11
Enter Mailing List: true
Last Name:Margaratte
First Name:Sophia
Address:5thstreet
City:Kottayam
State:Kerala
Zipcode:658789
Phone Number:123456789
Customer Number:11
Mailing List:Yes
-------------------------------------------------------------------------------------------------------------------------------------------
Enter Last Name:Selvam
Enter First Name: Chinna
Enter Address: 1083rdstreet
Enter City: Chennai
Enter State: Tamilnadu
Enter Zipcode: 600018
Enter Phone Number:987456132
Enter Customer Number: 1
Enter Mailing List: false
Last Name:Margaratte
First Name:Sophia
Address:5thstreet
City:Kottayam
State:Kerala
Zipcode:658789
Phone Number:123456789
Customer Number:11
Mailing List:No
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.