Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java coding help. Very confused. https://gyazo.com/145e33ce116b61319133d63472509cc4 https://gyazo.com/cc46493aa22feee2ea4746fe462f8c3c https://gyazo.com/1d78b71f5a8e85e71dc7eaebcfd8f661 https://gyazo.com/f7f22d312a6027fad99eb0b4c15e63f8 https://gyazo.com/784ddd1c022b1c1f8f8022c48f90a298 price of groceryon-grocery items. Once you implement the changes, you can uncomment the lines in
Java coding help. Very confused.
https://gyazo.com/145e33ce116b61319133d63472509cc4
https://gyazo.com/cc46493aa22feee2ea4746fe462f8c3c
https://gyazo.com/1d78b71f5a8e85e71dc7eaebcfd8f661
https://gyazo.com/f7f22d312a6027fad99eb0b4c15e63f8
https://gyazo.com/784ddd1c022b1c1f8f8022c48f90a298
price of groceryon-grocery items. Once you implement the changes, you can uncomment the lines in Main and run, you should an output similar to: A virtual item cannot have a quantity more than 1 Pencil 10 $0.99 Notepad 3 $1.99 Apple 5 $0.49 2017-11-11 Mango 10 $1.25 2017-12-1 imported from Mexico Wonder Woman 1 $9.99 2000.0MB Total price of all items is $40.81 Total price of grocery items is $14.95 Total price of non grocery items is $25.860000000000003 1 Add an attribute price (double) to Item. Add a setter method. Note that since ltem is the Base class of Groceryltem, ImportedGroceryltem, and Virtualltem, the attribute and the setter method are automatically inherited (how wonderful!) Modify the method toString to add the price to the result 2- 3- Next implement a method calculateTotal, also in item. This method returns the price quantity 4 In ShoppingCart, implement the method getTotal. This method returns the total price of all 5- Now, implement the method getGroceryTotal. This method returns the total price of grocery 6- Similarly, implement the method getNonGroceryTotal. This method returns the total price of of the item tems in the cart tems in the cart non-grocery items in the cart
Step 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