Introduction to Programming in Java Assignment Canned food Inventory System A warehouse is designed to store canned food in a standard bin. Each bin can store up to 10 canned foods. Each bin only stores the same type of canned food. All the bin stores different type of canned food. You are tasked to design a Canned food Inventory System to support the operation. Below is a description of the required J

Introduction to Programming in Java Assignment
Canned food Inventory System
A warehouse is designed to store canned food in a standard bin.
Each bin can store up to 10 canned foods.
Each bin only stores the same type of canned food.
All the bin stores different type of canned food.
You are tasked to design a Canned food Inventory System to support the operation.
Below is a description of the required Java classes (Bin, CannedFood, MyDate, and CannedFoodWareHouse:
Bin class
The Bin class has the following minimum requirements.
Fields

  • location: String
  • description: String (holds the type of canned food to be stored in this bin)
  • stock: Array of CannedFood (size of 10 – store canned food object)

Constructor:

  • Arguments: Location and Description
  • Initialize the stock array to a size of 10 CannedFood

Methods.

  • addCannedFood
    • Add a cannedFood object to the stock array
    • Return true if success, return false if array is full
  • getCannedFood
    • Return either
      • One of the Canned Food in the stock array or
      • The nearest expiry date in the stock array.
      • The canned food object must be removed from the stock array.
      • Implement one of the above, (nearest expiry date will gain higher marks.)
    • Return null if the stock array is empty

CannedFood class
The CannedFood class has the following minimum requirements.
Fields:

  • ID: String (unique)
  • Description: String
  • Expiry Date (MyDate data type – year, month, and day)
    • Note: do not use the standard Date or Calendar class in the Java package.

Constructor:

  • Arguments: ID, Description, and Expiry Date (year, month day)
  • Create the MyDate expiry date object in the constructor

Method:

  • – isExpired. Return true if the canned food is expired.

MyDate class
The MyDate class has the following minimum requirements.
Fields:

  • year: int
  • month: int (0-Jan,1-Feb, etc…)
  • day: int

Constructor:

  • Arguments: year, month, day

Method:

  • isBefore(year, month, day)
    • Return true if the current date is before the passed in the year, month, day.
    • Hint: use this to check if CannedFood has expired

CannedFoodWareHouse
The main driver class CannedFoodWareHouse has the following minimum requirements:
Field:

  • Bin array (to store the bins that store canned food) Constructor
  • Initialize the Bin array, we assume there are three bins
    • Bin 1 – Location: A1, Description: Beans
    • Bin 2 – Location: A2, Description: Sardine
    • Bin 3 – Location: A3, Description: Soup
  • Load the CannedFood data from a file into the three bins stock array. (see appendix for a sample of the data file)

Methods:
A menu driver method for the user to perform the following operations:
Insert a new canned food:

  • Select canned food Description and enter ID and Expiry date.
  • Search for the bin that store this type of canned food.
  • Store the canned food object into the bin stock array.

List canned food information:

  • Select canned food Description
  • Display the stock level of canned food in the bin
  • Display all the canned food information in the bin

Remove canned food:

  • Select canned food Description
  • Search for the bin that store this type of canned food
  • Get canned food from the bin. (the canned food object needs to be removed from the stock array)
  • Display the canned food information

Remove expired canned food:

  • All expired canned food objects in all the bins will be removed.

Exit and Save

  • Save all the updated canned food object back to the data files and exit the program.

Implement one more function that you deem that it is useful for the system.
Note: the user can keep selecting the Insert, List, and Remove functions until exit.
You are free to add more fields and methods to the above Java classes if you deem that it is appropriate and adhere to a good Object-Oriented design.
You need to handle all possible errors that will occur during the program execution:
For examples:

  • No canned food found
  • The stock array is full
  • Invalid date entered by the user.
  • The canned food ID entered by the user is not unique.

Documentation
Besides the Java Codes, you need to submit the following documentation:
A brief writeup of the system you have implemented

  • The functions you have implemented according to the requirements.
  • The functions you have not implemented according to the requirements.
  • The extra operation method that you deemed useful and have implemented.
  • The errors checking you have implemented.

Class UML diagram.
A short reflection on implementing this assignment.
Appendix
The data file format is
<ID>,< Description>,<Expiry Year>,< Expiry Month>,< Expiry Day>
CannedFood.txt data file sample
B101,Beans,2020,11,11
B102,Beans,2020,8,23
B103,Beans,2020,9,12
B104,Beans,2020,5,1
B105,Beans,2020,6,8
SA101, Sardine,2021,3,12
SA102, Sardine,2021,3,12
SA103, Sardine,2021,3,12
SO,101, Soup, 2022,7,30
You may use the Java Calendar class to get the current system to check for the expiry date.
Calendar calendar = Calendar.getInstance();
System.out.println(calendar.get(Calendar.DAY_OF_MONTH));
System.out.println(calendar.get(Calendar.MONTH));
System.out.println(cal

GET HELP WITH YOUR HOMEWORK PAPERS @ 25% OFF

For faster services, inquiry about  new assignments submission or  follow ups on your assignments please text us/call us on +1 (251) 265-5102

Write My Paper Button

WeCreativez WhatsApp Support
We are here to answer your questions. Ask us anything!
👋 Hi, how can I help?
Scroll to Top