Individual Assignment  Weightage : 80%  Introduction to Programming in Java Assignment (100 marks) 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. 

Individual Assignment 
Weightage : 80% 
Introduction to Programming in Java Assignment (100 marks) 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 
o Add a cannedFood object to the stock array 
o Return true if success, return false if array is full 
– getCannedFood 
o 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.) 
o Return null if 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) 
o Note: do not use the standard Date or Calendar class in 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) 
o Return true if current date is before the passed in year, month, day. o 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 
o Bin 1 – Location: A1, Description: Beans 
o Bin 2 – Location: A2, Description: Sardine 
o 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 with for the user to perform the following operations: Insert a new canned food: 
o Select canned food Description and enter ID and Expiry date. 
o Search for the bin that store this type of canned food. 
o Store the canned food object into the bin stock array.

List canned food information: 
o Select canned food Description 
o Display the stock level of canned food in the bin 
o Display all the canned food information in the bin 
Remove a canned food: 
o Select canned food Description 
o Search for the bin that store this type of canned food 
o Get a canned food from the bin. (the canned food object needs to be  removed from the stock array) 
o Display the canned food information 
Remove expired canned food: 
o All expired canned food object in all the bins will be removed. 
Exit and Save 
o 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 on more fields and methods to the above Java classes if you deem that it  is appropriate and adhere to good Object-Oriented design.  
You need to handle all possible errors that will occur during the program execution: For examples: 

  • No canned food found 
  • 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(calendar.get(Calendar.YEAR)); 
End of Assignment

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