Question: Create the following classes: Item + name: String + price: double quantity: Int Item(String name, double price, int quantity): + double totalPrice) Extends Extends Saleltem
Create the following classes: Item + name: String + price: double quantity: Int Item(String name, double price, int quantity): + double totalPrice) Extends Extends Saleltem Useditem Sale: double Old: Int Saleltem(String name, double price, in quantity, double Sale) - double totalPrice UsediterString name, double price, int quantity, int Old) double totalPrice) 1. In Item class, totalPrice returns the price by multiplying quantity * price 2. In Saleltem class, totalPrice calculates the price by multiplying quantity * price sale. 3. In Useditem class, totalPrice calculates the price by multiplying quantity price (1-old/100) 4. Create ItemTest class that creates objects from Item, Useditem and Saleltem using the constructors. 5. Print the totalPrice value by calling the methods
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
