Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The assignment name is Inventory. The purpose of this assignment is to practice class inheritance / polymorphism in Java. You are going to create four
The assignment name is Inventory. The purpose of this assignment is to practice class inheritancepolymorphism in Java.
You are going to create four classes which will be used to store items in a grocery store's inventory. The classes are:
GenericItem : This is a generic class that will be used to store generic items.
Produceltem: This is a class that inherits from the Genericltem class and is used to store produce items.
Bakeryltem: This is a class that inherits from the Genericltem class and is used to store bakery items.
Inventory: This is a class that will be used to store all items of the grocery store including generic, bakery and produce items
Here is the list of methods that each class must have:
Genericltem.java :
public void setNameString newName : sets the name of the generic item.
public void setQuantityint newQty : sets the quantity of the generic item in stock.
public void setExpirationString newDate : sets the expiration date of a generic item.
public String getExpiration : returns the expiration date of a generic item.
public void printltem : prints the item's name and item's quantity in stock. Example:
Item Name: Smith Cereal Quantity:
Bakeryltem.java :
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started