Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

make sure the output is the same as above returned Problem 3: Customer Robert has opened his own pet supply store so he can help

image text in transcribedmake sure the output is the same as above returned

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.getTotalAmountspent(); // 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.getTotalAmountSpent(); // 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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions