Answered step by step
Verified Expert Solution
Link Copied!

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 inheritance/polymorphism 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 setName(String newName) : sets the name of the generic item.
public void setQuantity(int newQty) : sets the quantity of the generic item in stock.
public void setExpiration(String 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: 300
Bakeryltem.java :
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions