15.05 Assignment Instructions
1. Create a folder called 15.05 Assignment in your module 15 assignments folder.
2. Create an interface named Product .
a. Add a method called getName() that returns a string.
b. Add a method called getCost() that returns a double.
3. Create abstract class Vehicle that implements Product.
a. It should have string variable name and double cost, that are initialized in the constructor.
b. Add appropriate getName() and getCost() methods
4. Create classes Car and Truck that extend Vehicle.
a. No other methods are needed.
5. Create class Tool that implements Product and Comparable<T> .
a. It should have string variable name and double cost that are initialized in the constructor.
b. Add appropriate getName() and getCost() methods.
c. Add a compareTo() method that compares tools based upon cost .
6. Create class InventoryDemo.
a. Test your classes by using ArrayList products of following products (Remember to declare it
properly using List):
Name Cost
Jaguar 1000000.00
Neon 17000.00
JigSaw 149.18
Jaguar 110000.00
Neon 17500.00
Neon 17875.32
RAM 35700.00
CircularSaw 200.00
CircularSaw 150.00
b. Create a static method takeInventory that, when passed the name of a product, will go
through the list and print out <item name>: Quantity = <quantity>, Total cost = <totalcost>.
<item name> is the name of the product, <quantity> and <totalcost> are the values you
calculate by going through the list for the product with name that was passed to takeInventory.
This is what I have.
public abstract class Vehicle implements Product { private String name; private int cost; public Vehicle() { name = ""; cost = 0; } public abstract String getName(); public abstract double getCost(); }public class Car extends Vehicle { public Car() { super(); } }The latter two throw errors and I know why, but how can I fix probleems using guidelines given, and dont I need setters for the vehicle class.The latter two throw errors and I know why, but how can I fix probleems using guidelines given, and dont I need setters for the vehicle class.public class Truck extends Vehicle { public Truck() { super(); } }