Inventory With Inheritance Project

This project was one of the first projects that introduced me to inheritance with classes. It built further on the former Inventory Array Project, but in the case it also classified the inventory as either food or clothing. It asked for clothing size if it was designated as clothing, and asked if it needs to be refrigerated if it was designated as food. The Food and Clothing classes inherited from the Inventory class. After the user puts in all the items that they want from the inventory, the program lets the user "buy" from the inventory until they decide that their purchasing is finished. The program uses a helper method to search for the item ID, and if the user input doesn't match the ID of an item in the inventory, the program will print an error message.

Program Run

Main Class Code

Inventory Class Code

Food Class Code

Clothing Class Code