Java代写 | Individual Assignment

Individual Assignment

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
Bin class
The Bin class has the following minimum requirements.
– 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)
– Arguments: Location and Description
– Initialize the stock array to a size of 10 CannedFood
– 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
o Return null if stock array is empty
CannedFood class
The CannedFood class has the following minimum requirements.
– 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.
– Arguments: ID, Description and Expiry Date (year, month day)
– Create the MyDate expiry date object in the constructor
– isExpired. Return true if the canned food is expired.
MyDate class
The MyDate class has the following minimum requirements.
– year: int
– month: int (0-Jan,1-Feb etc…)
– day: int
– Arguments: year, month, day
– 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
The main driver class CannedFoodWareHouse has the following minimum requirements:
– Bin array (to store the bins that store canned food)
– 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)
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
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.
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.
The data file format is
<ID>,< Description>,<Expiry Year>,< Expiry Month>,< Expiry Day>
CannedFood.txt data file sample
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();


本网站支持淘宝 支付宝 微信支付  paypal等等交易。如果不放心可以用淘宝交易!

E-mail: [email protected]  微信:itcsdx