Question: java Problem 3: Customer Robert has opened his own pet supply store so he can help himself to treats and toys whenever he wishes. In

java Problem 3: Customer Robert has opened his own pet supply storejava

Problem 3: Customer Robert has opened his own pet supply store so he can help himself to treats and toys whenever he wishes. In order to encourage customers to shop at his store more, he is implementing a customer loyalty program. For every $100 spent, the customer earns a 10% discount on a future purchase. If the customer has earned a discount, that discount will be automatically applied whenever they make a purchase. Only one discount can be applied per purchase. Implement a class Customer that represents a customer in Robert's store. Customer must include the following public methods: Customer ) // Constructor that constructs a new Customer object void make Purchase (double amount) // adds a purchase for the amount to the customer's account; assume the amount will always be a valid monetary amount > 0 int getNumDiscountstouse () // returns the number of discounts this customer has on their account to be used on future purchases double getTotalAmount Spent() // Returns the total amount this customer has spent on all their purchases Example: Customer c = new Customer(); c.make Purchase (75); c.getNumDiscountsTouse(); // returns 0 c.getTotalAmount Spent (); // returns 75.0 c.make Purchase (50.25); c.getNumDiscountsToUse(); // returns 1 c.getTotalAmount Spent(); // returns 125.25 c.make Purchase (9.99); c.getNumDiscountsToUse(); // returns 0 c.getTotalAmount Spent(); // returns 134.24099999999999 c.make Purchase (234.30); c.getNumDiscountsToUse(); // returns 2 c.getTotalAmount Spent (); // returns 368.541 c.make Purchase (10); c.getNumDiscountsToUse(); // returns 1 c.getTotalAmount Spent(); // returns 377.541

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!