Question: #include #include using namespace std; class PersonData { private: string lastname; string firstname; string address; string city; string State; string zip; string phonenumber; public: void
#include
zip = z; } void setphonenumber(string p) { phonenumber = p; } string getlastname() { return lastname; } string getfirstname() { return firstname; } string getaddress() { return address; } string getcity() { return city; } string getState() { return State; } string getzip() { return zip; } string getphonenumber() { return phonenumber; } }; class CustomerData: public PersonData { private: int customernumber; bool mailinglist; public: void setcustomernumber(); void setmailinglist(); int getcustomernumber(); }; void CustomerData::setcustomernumber() { int customer; cout <<"enter the member Id:"; cin >> customer; customernumber = customer;
} void CustomerData::setmailinglist() { bool Mail; string yesorno; cout <<"would you like to be on the mailing list? enter yes or no:)" endl; cin >> yesorno; if (yesorno == "Yes" || yesorno == "yes") { cout <<"You are part of the mailing list:" < } int main() { CustomerData Y; string LASTNAME; string FIRSTNAME; string ADDRESS; string CITY; string STATE; int ZIP; int PHONE; int CustomerID; bool trueorfalse; cout << "Enter Lastname: " << endl; getline(cin, LASTNAME); cout<< "Enter Firstname: " << endl; getline(cin, FIRSTNAME); cout << "Enter Address: " << endl; getline(cin, ADDRESS); cout << "Enter City: " << endl; getline(cin, CITY); cout << "Enter State: " << endl; getline(cin, STATE); cout << "Enter Zip code: " << endl; geline(cin, ZIP); cout << "Enter Phone number: " << endl; getline (cin, PHONE); Y.setlastname(LASTNAME); Y.setfirstname(FIRSTNAME); Y.setaddress(ADDRESS); Y.setcity(CITY); Y.setState(STATE); Y.setzip(ZIP); Y.setphonenumber(PHONE); Y.setcustomernumber(); Y.setmailinglist(); cout << "Customer ID: " << Y.getcustomernumber() << endl; cout << "First and last name: " << Y.getfirstname() << " " << Y.getlastname() << endl; cout << "Address: " << Y.getaddress() << " " << Y.getcity() << " " << Y.getState() << " " << Y.getzip() << endl; cout << "Phone number: " << Y.getphonenumber() << endl; return 0; } ************************ *********************PersonData and Customer Data 1. Design a class named PersonData with the following member variables: lastName firstName address city state zip phone Write the appropriate accessor and mutator functions for these member variables. CS 2 Fall 2016 E. Ambrosio 2 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 boolean. 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. Finally, demonstrate an object of the CustomerData class in a simple program Help my program is not working!!!!!!!!!!!!!!!!!!!! C++ once I put in the state it falls through - I dont get a chance to put in zip or phone- out put unformatted and garbled thanks using codeblock
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
