Question: Java Help Design a class named Person with fields for holding a persons name, address, and telephone number. Write one or more constructors and the
Java Help
Design a class named Person with fields for holding a persons name, address, and telephone number. Write one or more constructors and the mutator and accessor methods for the fields, along with a toString( ) method. Next, design a class named Customer, which inherits from the Person class, The Customer class should have a field for a customer id number and a boolean field indicating if the customer wishes to be on the mailing list. Write one or more constructors and the appropriate mutor and accessor methods for this class. Write a toString( ) method that also calls the super( ) toString method. A retail store has a preferred customer plan where customers can earn discounts on all their purchases. The amount of the customers discout is determined by the amount of the customers cumulative purchases in the store, as follows: When a preferred customer spends $500, he or she gets a 5% discount on all future purchases, When a preferred customer spends $1,000, he or she gets a 6% discount on all future purchases. When a preferred customer spends $1,500, he or she get a 7% on all future purchases. When a preferred customer spends $2,000 or more, he or she gets a %10 discount on all future purchases. Design a class named PreferredCustomer, which inherits from the Customer class. The PreferredCustomer should have fields for the amount of the customers purchases and the customers discount level. Write one or more constructors and the mutator and accessor methods along with a toString( ) method that calls the super toString( ) method. Create a Driver class that creates an array of four Persons. Populate the array with Customers and PreferredCustomer object references. Test the classes you wrote by calling the methods and displaying the results.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
