Question: Design and implement a class: CashRegister Design and implement a CashRegister class that scans the product prices, counts the number of items and shows the

Design and implement a class: CashRegister Design and implement a CashRegister class that scans the product prices, counts the number of items and shows the total purchase. Hints: Scanning a product price is to take the price and add it to the total purchase; You do not need to consider rounding and formatting purchase values to dollars and cents in this exercise. First identify class fields (object state) that are required and methods (object behaviours) that are needed on the fields (accessor or mutator the state). Create a class diagram to describe your class design in the startup code CashRegister.java, using the following format. ============================== CashRegister ------------------------------ (fields here) ------------------------------ (methods here) ============================== Now, complete the main program, CheckOut.java, using your CashRegister class to scan products and display the number of items and total purchase as indicated in the program and follows. The CheckOut program will use your Product class created in Exercise 1. 1. Create a CashRegister object; 2. scan 3 products: Milk ($2.99), Apple ($5.49) and Bread ($1.75); 3. display the number of items purchased; 4. display the total purchase; 5. scan one more product: Apple; 6. display the number of items purchased; 7. display the total purchase; 8. create another CashRegister object; 9. scan 2 products: Milk and Bread; 10. display the number of items purchased; 11. display the total purchase. Compile and run CheckOut program. You should see the following output: ***** At Register 1 ***** You have purchased 3 items Total: $10.23 You have purchased 4 items Total: $15.72 ***** At Register 2 ***** You have purchased 2 items Total: $4.74

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!