Question: Write a class named Person with fields for holding a person's name, address, and telephone number. Write a three - argument constructor and the appropriate
Write a class named Person with fields for holding a person's name, address, and telephone number. Write a threeargument constructor and the appropriate mutator and accessor methods for the class's variables. Create an exception class for each of the variables: NameException This exception will be thrown when the person's name includes characters other than letters. AddressException This exception will be thrown when the adress is incorrect. An address is incorrect if it does not consist of a series of numbers followed by a space followed a series of letters. Here are a few examples: s New Hampshire Incorrect because there is a letter where there should be a number New HampshirIncorrect because there is a number where there should be a letter New Hampshire Incorrect because there is no space between the numbers and letters TelephoneException This exception will be thrown when the phone number includes characters other than numbers or has a length other than characters long. You can assume the number will be passed in the following format: Next, design a class named Customer, which extends the Person class. The Customer class should have a field for a customer id number and a boolean field indicating whether the customer wishes to be on a mailing list. Write one constructor that calls the Person class constructor and mutator and accessor methods for the class's fields. Finally, create a class named Main that creates a Customer and Person object.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
