Problem

Cash RegisterDesign a CashRegister class that can be used with the InventoryItem class dis...

Cash Register

Design a CashRegister class that can be used with the InventoryItem class discussed in this chapter. The CashRegister class should perform the following:

1. Ask the user for the item and quantity being purchased.

2. Get the item’s cost from the InventoryItem object.

3. Add a 30% profit to the cost to get the item’s unit price.

4. Multiply the unit price times the quantity being purchased to get the purchase subtotal.

5. Compute a 6% sales tax on the subtotal to get the purchase total.

6. Display the purchase subtotal, tax, and total on the screen.

7. Subtract the quantity being purchased from the onHand variable of the InventoryItem class object.

Implement both classes in a complete program. Feel free to modify the InventoryItem class in any way necessary.

Input Validation: Do not accept a negative value for the quantity of items being purchased.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT