7. PersonData and CustomerData classes
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 . 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 mail- ing list.
Write appropriate accessor and mutator functions for these member
variables . Demonstrate an object of the CustomerData class in a
simpleprogram .
#include
using namespace std;
class PersonData
{
private:
string lastName,firstName, address, city, state,zip, phone;
public:
//set and get methods
void setLastName(string lastName)
{
this->lastName = lastName;
}
string getLastName()
{
return lastName;
}
void setFirstName(string firstName)
{
this->firstName = firstName;
}
string getFirstName()
{
return firstName;
}
void setAddress(string address)
{
this->address = address;
}
string getAddress()
{
return address;
}
void setCity(string city)
{
this->city = city;
}
string getCity()
{
return city;
}
void setState(string state)
{
this->state = state;
}
string getState()
{
return state;
}
void setZip(string zip)
{
this->zip = zip;
}
string getZip()
{
return zip;
}
void setPhone(string phone)
{
this->phone = phone;
}
string getPhone()
{
return phone;
}
};
class CustomerData : public PersonData
{
private:
int customerNumber;
bool mailingList;
public:
//set and get methods
void setCustomerNumber(int customerNumber)
{
this->customerNumber = customerNumber;
}
int getCustomerNumber()
{
return customerNumber;
}
void setMailingList(bool mailingList)
{
this->mailingList = mailingList;
}
int getMailingList()
{
return mailingList;
}
};
int main() {
CustomerData cust;
cust.setCustomerNumber(1007);
cust.setMailingList(true);
cust.setLastName("Jones");
cust.setFirstName("Emily");
cust.setAddress("7764,Hillside");
cust.setCity("Trenton");
cust.setState("NJ");
cust.setZip("08625-0088");
cust.setPhone("768-687878");
cout<<"Customer Number :
"<
return 0;
}
output:
Customer Number : 1007
Name : Emily Jones
Address : 7764,Hillside,Trenton,NJ 08625-0088
Phone : 768-687878
Do ask if any doubt. Please upvote.
7. PersonData and CustomerData classes Design a class named PersonData with the following member variables...
7. PersonData and CustomerData classes 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. 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 customer Number variable will be used to hold a unique integer for each customer. The mailing List variable should be a bool....
Design a class for python 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. 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...
This is a C++ program Instructions Design a class named PersonData with the following member variables declared as strings: lastName firstName address city state zip phone Create 3 constructors; a default constructor, a constructor that accepts the first and last name member variables, and a constructor that accepts all member variables. Write the appropriate accessor/getter and mutator/setter functions for these member variables. Create a method within this class called getFullName() that returns the person's first and last names as a...
WRITE IN C++ ONLY PLEASE. IM USING VISUAL STUDIO CODE.1. Employee and ProductionWorker ClassesDesign a class named Employee. The class should keep the following information in• Employee name• Employee number• Hire dateWrite one or more constructors and the appropriate accessor and mutator functions for the class.Next, write a class named ProductionWorker that is derived from the Employee class. The ProductionWorker class should have member variables to hold the following information:• Shift (an integer)• Hourly pay rate (a double )The workday...
Design a class named Person with fields for holding a person's name, address, and telephone number (all as Strings). Write a constructor that initializes all of these values, and mutator and accessor methods for every field. Next, design a class named Customer, which inherits from the Person class. The Customer class should have a String field for the customer number and a boolean field indicating whether the customer wishes to be on a mailing list. Write a constructor that initializes...
this is java m. please use netbeans if you can.
7. Person and Customer Classes Design a class named Person with fields for holding a person's name, address, and telephone number. Write one or more constructors and the appropriate mutator and accessor methods for the class's fields. Next, design a class named Customer, which extends the Person class. The Customer class should have a field for a customer number and a boolean field indicating whether the cus- tomer wishes to...
Using JAVA* Design a class named Person with fields for holding a person’s name, address, and telephone number. Write one or more constructors and the appropriate mutator and accessor methods for the class’s fields. Next, design a class named Customer, which extends the Person class. The Customer class should have a field for a customer number and a boolean field indicating whether the customer wishes to be on a mailing list. Write one or more constructors and the appropriate mutator...
in C++: Create a class named Student that has three member variables: name - string that stores the name of the student numClasses - integer that tracks how many courses the student is currently enrolled in, this number must be between 1 and 100. classList - an array of strings of size 100 used to store the names of the classes that the student is enrolled in Write the appropriate constructor(s), mutator and accessor functions for the class along with...
Code the following Program in C++ Define a class named Payment that contains a member variable of type float that stores the amount of the payment and appropriate accessor and mutator methods. Also create a member function named paymentDetails that outputs an English sentence that describes the amount of the payment. Next define a class named CashPayment that is derived from Payment. This class should redefine the paymentDetails function to indicate that the payment is in cash. Include appropriate constructor(s)....
Please use Java Question 3: Person and Customer classes: Design a class named Person with properties for holding a person's name, address, and telephone number. Next, design a class named Customer, which is derived from the Person class. The Customer class should have a property for a customer number and a Boolean property indicating whether wishes to be on a mailing list. Demonstrate an object of customer class in a simple GUI application. Write the code include appropriate input validation,...