So the assignment is to Modify the Inventory Program by creating a subclass of the product class that uses an additional unique feature of the product you chose (for the DVDs subclass, you could use movie title, for example). In the subclass, create a method to calculate the value of the inventory of a product with the same name as the method previously created for the product class. The subclass method should also add a 5% restocking fee to the value of the inventory of that product. I finally got the first part to work write but I am struggling with even getting started on the subclass.
Here's a tutorial on inheritance. https://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html Since you gave your existing class the generic name "Product" you may want a subclass "ProductWithRestockingFee" (or something like that).
Then you need to look at your requirements and ask what needs to be added to the new class that isn't already in your existing class.
FYI I also fixed the indentation of your code when I re-posted it.
Something you'll need to fix in your existing code is the constructor. It doesn't do anything with the parameters.
Also variable names should start with a lower case character.
Thank you. Here is what the assignment is asking for. Override the toString to display the additional attribute, and your main method will automatically display it if you add an instance of the subclass to your array or array list.
In the subclass, override getTotalValue() to include a 5% restock fee. Similiar to above, if you add an instance of the subclass to your array of Product, you will see it chooses the overridden methods and uses the toString and getTotalValue() from the subclass while instances of the parent class will not.
There is a misunderstanding in that instruction. It says
your main method will automatically display it
What you do is to override the toString method, and then you let polymorphism work its magic. Note the word polymorphism turns into a link. Click on that link. You find out the jiggery‑pokery is done by the Product object, not the main method.