1. Create a folder called Assessment.

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 get Cost() 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
CircualrSaw 150.00

b. Create a static method takelnventory 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 take Inventory.

c. To test the compare To() method, create two Tools, sawl, and saw2. Give them different prices and then test the compareTo() method you made, by displaying which one is more expensive.

Your output should be similar to: see image.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.