THE PROGRAM IS IN JAVA. Question: Use Inheritance and Polymorphism to retrieve the data from file. shopping.txt Diary Milk 2 4.00 Meat Chicken XXXXXXXXXX Snack Chocolate 3 4.50 Diary Chees 5 2.50...

1 answer below »

THE PROGRAM IS IN JAVA.


Question:


Use Inheritance and Polymorphism to retrieve the data from file.


shopping.txt


Diary Milk 2 4.00
Meat Chicken 3 15.00
Snack Chocolate 3 4.50
Diary Chees 5 2.50
Snack Chips 5 3.50
Beverages Juice 3 4.50
Meat Turkey 4 5.50
Diary Yogurt 5 2.50
Beverages Coke 6 2.50
Fruits Watermelon 2 3.50
Meat Beef 2 25.00
Fruits Strawberry 2 5.50
Diary CoffeCream 2 3.50
Snack Hershey 2 3.50
Fruits Grapes 3 4.50


So, try to retrieve the data where it will show the output example:



Brand Item Quantity Price Amount


----------------------------------------------------------------

Diary Milk 2 4.00 8.00
Meat Chicken 3 15.00 45.00
Snack Chocolate 3 4.50 13.50
Diary Chees 5 2.50 12.50
Snack Chips 5 3.50 17.50
Beverages Juice 3 4.50 13.50
Meat Turkey 4 5.50 22.00
Diary Yogurt 5 2.50 12.50
Beverages Coke 6 2.50 15.00
Fruits Watermelon 2 3.50 7.00
Meat Beef 2 25.00 50.00
Fruits Strawberry 2 5.50 11.00
Diary CoffeCream 2 3.50 7.00
Snack Hershey 2 3.50 7.00
Fruits Grapes 3 4.50 13.50


------------------------------------------------------------------------



Tax: 7.85
Grand Total: 178.49


-------------------------------------------------------------------------


So basically the first name is brand, item, quantity, price and then you will be able to add another column in display of amount or (quantity * price) and then display grand total price of shopping.


Do the basic things that we always do with menu:


1. Show all items based on first initial of brand name.


2. Show all items based on whole brand name.


3. Search by brand name.


4. Search by item name.


5. Sort by brand name


6. Sort by item name




Some output might looks like this too:



Brand Item Quantity Price Amount


---------------------------------------------------------

Diary Milk 2 4.00 8.00
Diary Chees 5 2.50 12.50
Diary Yogurt 5 2.50 12.50
Diary CoffeCream 2 3.50 7.00




Subtotal: 45.00


Meat Chicken 3 15.00 45.00
Meat Turkey 4 5.50 22.00
Meat Beef 2 25.00 50.00




Subtotal: 117.00


Snack Chocolate 3 4.50 13.50
Snack Chips 5 3.50 17.50
Snack Hershey 2 3.50 7.00




Subtotal: 28.00


Fruits Watermelon 2 3.50 7.00
Fruits Strawberry 2 5.50 11.00
Fruits Grapes 3 4.50 13.50




Subtotal: 31.50


Beverages Juice 3 4.50 13.50
Beverages Coke 6 2.50 15.00




Subtotal: 28.50




Grand Total:168.49

Answered Same DayMay 10, 2021

Answer To: THE PROGRAM IS IN JAVA. Question: Use Inheritance and Polymorphism to retrieve the data from file....

Aditya answered on May 10 2021
138 Votes
Diary Milk 2 4.00
Meat Chicken 3 15.00
Snack Chocolate 3 4.50
Diary Chees 5 2.50
Snack Chips 5 3
.50
Beverages Juice 3 4.50
Meat Turkey 4 5.50
Diary Yogurt 5 2.50
Beverages Coke 6 2.50
Fruits Watermelon 2 3.50
Meat Beef 2 25.00
Fruits Strawberry 2 5.50
Diary CoffeCream 2 3.50
Snack...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here