Question: Java code please. PreferredCustomer Class A retail store has a preferred customer plan where customers can earn discounts on all their purchases. The amount of
Java code please.
PreferredCustomer Class
A retail store has a preferred customer plan where customers can earn discounts on all their purchases. The amount of a customers discount is determined by the amount of the cus-tomers cumulative purchases in the store as follows:
When a preferred customer spends $500, he or she gets a 5 percent discount on all future purchases.
When a preferred customer spends $1,000, he or she gets a 6 percent discount on all future purchases.
When a preferred customer spends $1,500, he or she gets a 7 percent discount on all future purchases.
When a preferred customer spends $2,000 or more, he or she gets a 10 percent dis-count on all future purchases.
Design a class named PreferredCustomer, which extends the Customer class you created in Programming Challenge 7.
The PreferredCustomer class should have fields for the amount of the customers purchases and the customers discount level. Write one or more construc-tors and the appropriate mutator and accessor methods for the classs fields. Demonstrate the class in a simple program.
Java file must ba named as : PreferredCustomerDemo.java
Create following preferred customer objects and display the discount level:
PreferredCustomer preferredcustomer1 = new PreferredCustomer("John Adams", "Los Angeles, CA", "3235331234", 933, true, 400); System.out.println(preferredcustomer1.toString() + " "); PreferredCustomer preferredcustomer2 = new PreferredCustomer("Susan Adams", "Los Angeles, CA", "3235331234", 933, true, 600); System.out.println(preferredcustomer2.toString()+ " "); PreferredCustomer preferredcustomer3 = new PreferredCustomer("Mary Adams", "Los Angeles, CA", "3235331234", 933, true, 1100); System.out.println(preferredcustomer3.toString()+ " "); PreferredCustomer preferredcustomer4 = new PreferredCustomer("Larry Adams", "Los Angeles, CA", "3235331234", 933, true, 1600); System.out.println(preferredcustomer4.toString()+ " "); PreferredCustomer preferredcustomer5 = new PreferredCustomer("Mony Adams", "Los Angeles, CA", "3235331234", 933, true, 2600); System.out.println(preferredcustomer5.toString()+ " ");
The output:
Cust Name:John Adams CustID: 933 Telephone Number: 3235331234 Mail List Status: true Purchase 400.0 Discount Percent 0.0
Cust Name:Susan Adams CustID: 933 Telephone Number: 3235331234 Mail List Status: true Purchase 600.0 Discount Percent 5.0
Cust Name:Mary Adams CustID: 933 Telephone Number: 3235331234 Mail List Status: true Purchase 1100.0 Discount Percent 6.0
Cust Name:Larry Adams CustID: 933 Telephone Number: 3235331234 Mail List Status: true Purchase 1600.0 Discount Percent 7.0
Cust Name:Mony Adams CustID: 933 Telephone Number: 3235331234 Mail List Status: true Purchase 2600.0 Discount Percent 10.0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
