Question: Java You will create and test two classes for this assignment: Batailltem and Transaction. The UML diagram for these followed by a tab character, followed
Java
You will create and test two classes for this assignment: Batailltem and Transaction. The UML diagram for these followed by a tab character, followed by the total price for that line (rounded to 2 decimal places). No item should appear on more than one line. So, if three of one item are purchased, this should be reflected in a quantity of 3, not in listing the item 3 times. classes is below. After the diagram is some additional details about the specifications for this. Retallite Example: - description: String Inventory. Integer Ream of paper 2 13.98 Candy bar 1 1.50 string inventory. Integer, price: Double) cecreate> Retailltes description get Description ) string getPrice ) - set Description String) Box of pens 3 4.50 This example is for a transaction with two reams of paper (sold at 56.99 each), one candy bar (sold at $1.50 wubier each), and three boxes of pens (sold at $1.50 each). Note that the order of printed rows does not matter. - The sanselpursbass method must clear the list of items in the transaction without making any changes itens! ArrayList to the inventory. - The sameletePurchase method must clear the list of items in the transaction and adjust the inventory cecreate Transaction( ) purchase Item( Retail ten purchaserte Retail tem, quantity receiptis ering complete Purchase ) accordingly. Example: For the example transaction in the previous bullet point, when the transaction is completed, the list of items must be made empty, the inventory for the ream of paper object must be decreased by 2, the You may create additional classes and/or methods to support the operations in the diagram You must fully implement both of the classes in the diagram. These classes must be added to the projects package you created during setup in order for the antorcader to work inventory for the candy bar object must be decreased by 1, and the inventory for the box of pens object must be decreased by 3. You must fully test all classes you write using JUnit testing - The purchase item method adds the item given in the argument to the list of items in the transaction. If a quantity is provided, then that number of items must be added. - The getTotal method returns the total cost of all items in the transaction. (We're ignoring tax.) - The receipt method returns a multi-line string listing all products in the transaction in the following format: Each line has the item description, followed by a tab character, followed by the quantity (must be > 0), Activate Windows Go to Settings to activate
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
