Design a class for python named PersonData with the following member variables:
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:
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.
Next write a program which demonstrates an object of the CustomerData class in a program. Your program MUSTuse exception handling. You can choose how to implement the exception handling.
Tips for full credit
Thanks for the question.
Here is the completed code for this problem. Comments are included so that you understand whats going on. Let me know if you have any doubts or if you need anything to change.
Thank You !!
========================================================================================
class PersonData():
def __init__(self, lName, fName, address, city, state, zip, phone):
self.lastName = lName
self.firstName = fName
self.address = address
self.city = city
self.state = state
self.zip = zip
self.phone = phone
def getFirstName(self): return self.firstName
def getLastName(self): return self.lastName
def getAddress(self): return self.address
def getCity(self): return self.city
def getState(self): return self.city
def getZip(self): return self.zip
def getPhone(self): return self.phone
def setFirstName(self, data): self.firstName = data
def setLastName(self, data): self.lastName = data
def setAddress(self, data): self.address = data
def setCity(self, data): self.city = data
def setState(self, data): self.city = data
def setZip(self, data): self.zip = data
def setPhone(self, data): self.phone = data
# CustomerData class starts here
class CustomerData(PersonData):
def __init__(self, lName, fName, address, city, state, zip, phone):
super().__init__(lName, fName, address, city, state, zip, phone)
self.customerNumber = None
self.mailingList = False
def setCustomerNumber(self, num): self.customerNumber = num
def setMailingList(self, flag): self.mailingList = flag
def getCustomerNumber(self): return self.customerNumber
def isOnMailingList(self): return self.mailingList
# CustomerData class ends here
# function that takes in a customerData class object and prints all the info
# raises Exception if the object passed is not of CustomerData type
def printCustomer(customer):
if isinstance(customer, CustomerData):
print('Full Name: {0}'.format(customer.getFirstName() + ', ' + customer.getLastName()))
print('Address: {0}, City: {1}, State: {2}, Zip: {3}'.format(customer.getAddress(), customer.getCity(), \
customer.getState(), customer.getZip()))
print('Phone Number: {0}'.format(customer.getPhone()))
print('Customer Number: {0}'.format(customer.getCustomerNumber()))
if customer.isOnMailingList():
print('Customer is on in mailing list.')
else:
print('Customer is not on mailing list.')
else:
raise Exception('Incorrect type requested.')
def main():
# test exception when the type is not CustomerData
s ='Test'
try:
printCustomer(s)
except Exception as e:
print(e)
# create an object of CustomerData and print all the details
customer = CustomerData('Zhu','Dora','123 Broad Road','San Francisco','Texas','56780','123-456-7890')
customer.setCustomerNumber(123)
customer.setMailingList(True)
printCustomer(customer)
main()



Design a class for python named PersonData with the following member variables: lastName firstName address city...
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....
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....
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...
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...
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...
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...
C++ Visul Studio Create a class named Vehicle. The class has the following five member variables: • Vehicle Name • Vehicle number • Sale Tax • Unit price • Total price Include set (mutator) and get (accessor) functions for each field except the total price field. The set function prompt the user for values for each field. This class also needs a function named computePrice() to compute the total price (quantity times unit price + salesTax) and a function to...
C++ 8. Circle Class Write a Circle class that has the following member variables: • radius: a double • pi: a double initialized with the value 3.14159 The class should have the following member functions: • Default Constructor. A default constructor that sets radius to 0.0. • Constructor. Accepts the radius of the circle as an argument. • setRadius. A mutator function for the radius variable. • getRadius. An accessor function for the radius variable. • getArea. Returns the area...
Write a C++ program Write a class named Employee that has the following member variables: name A string that holds the employee name idNumber An int to hold employee id number department A string to hold the name of the department position A string to hold the job position The class will have three constructors: 1. A constructor that accepts all the internal data such as: Employee susan("Susan Meyers", 47899, "Accounting", "Vice President"); 2. A constructor that accepts some of...
Design a JAVA program with the class named Computer that creates a computer object that stores the computer's brand, model, memory (in GB) and storage (in GB). The class must contain the following instance variables and methods. All variable and method names must match the specifications listed below exactly. Instance Variables: - a String variable named brand - a String variable named model - an int variable named memory - an int variable named storage Methods: The accessor and mutator...