Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please use Java: Cash Register simulation In this programming challenge, you will simulate a cash register. The client program will work like this: You will
Please use Java:
Cash Register simulation In this programming challenge, you will simulate a cash register. The client program will work like this: You will use an array or ArrayList to simulate a shopping cart. You will add Retail!tem objects to your shopping cart. The CashRegister class will process the Retail Items in your cart Create a sales receipt that is an itemization of all the items in your shopping cart and a total cost for all items properly formatted. Use the following UML diagrams to create the class objects, Retailltem and CashRegister. The classes should have appropriate constructor(s), accessor, and mutator methods A Retailltem holds the data about an item in a retail store. The class should have the following fields: description: The description field references a String object that holds a brief description of the item price: The price field is a double that holds the item's retail price numOfpurchase . The numOfpurchase field is an int that holds the quantity of items in cart RetailItem - description : String - price: double - numofpurchase: int +RetailItem (d String, p : double, n : int) +setDescription (d string): void +setPrice (p: double): void +setNumOfPurchase (n : int) : void +get Description () : String +get Price() double +getNumOfPurchase() : int A CashRegister object will process each Retailltem to determine cost of item with tax. It will simulate the sale of a retail item. It should have a constructor that accepts a Retailltem object as an argument. In addition, the class should have the following instance variables and methods: retailPrice : The retai!Price field will store the price of the RetailItem being passed to constructor. quantity. The quantity field will store the quantity of the current Retail!tem in your cart. The SubTotal method should return the subtotal of the sale, which is the quantity multiplied by the retail priceStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started