University | The Royal Melbourne Institute of Technology (RMIT) |
Subject | Introduction to Programming in Java |
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
- Return either
Buy Custom Answer of This Assessment & Raise Your Grades
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(calendar.get(Calendar.YEAR));
Our information technology assignment writers are well qualified and highly experienced for offering an introduction to programming in java assignment help. They are educated from top universities and colleges from all over the world. We offer brilliant Java assignment help to computer science students.
Looking for Plagiarism free Answers for your college/ university Assignments.
- A2429C Case Study Assignment: Glucose Homeostasis, Muscle Function, and Cardiovascular-Lymphatic Disorders
- Finance/ Wealth Management Assignment: Broker Report on Equity and Bond Valuation for Global Listed Companies
- PSB503IT Team Project Reflective Report Assignment: Enhancing Collaboration and Professional Development
- Microbiology Assignment: The Role of Medical Microbiologists in Disease Control and Their Contribution to Public Health
- A2389C Pharmaceutical Supply Chain Case Study Assignment: Emergency Preparedness Plan for Tariff Impact in Singapore
- Mobile Learning App Evaluation Report Assignment: Usability, Design, and Learning Outcome Analysis
- CTA Psychotherapy Intervention Essay Assignment: Sheila Case Study on Managing Anxiety and Marital Stress
- DSM500 Machine Learning Project Proposal: Retail Sales Forecasting with Time Series Models
- Project Management Assignment 2: The Shard UK Case Study on Risk & Stakeholder Strategies in Construction Projects
- CSIT121 Banking Application Assignment: OOP-Based Customer & Account Management System in Python