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....
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...
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...
Using C++, Write a class named Employee that has the following member variables: name. A string that holds the employee's name. idNumber. An int variable that holds the employee's ID number. department. A string that holds the name of the department where the employee works. position. A string that holds the employee's job title. The class should have the following constructors: A constructor that accepts the following values as arguments and assigns them to the appropriate member variables: employee's name,...
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...
1a. Create a class named Inventory - Separate declaration from implementation (i.e. Header and CPP files) 1b. Add the following private member variables - a int variable named itemNumber - an int variable named quantity - a double variable named cost - a double variable named totalCost. Total cost is defined as quantity X cost. - updateTotalCost() which takes no arguments and sets the values of the variable totalCost. 1c. Add the following public functions: - Accessor and Mutators for...