Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using data structures from Java Collections is not allowed please implement your own data structures A . Objectives 1 . Use ArrayList to store items
Using data structures from Java Collections is not allowed please implement your own data structures
A Objectives
Use ArrayList to store items in the pantry.
Implement methods to add, distribute, and search for items.
Ensure the main method does not exceed lines of code.
Implement the project correctly.
If you can can you please add meaningful identifiers, consistent indentation, explanatory
comments, and properly formatted output but also explain because I want to learn as much as possible.
B Description
You are tasked with developing a Food Pantry Management System for a college. This system
will help manage the inventory of a food pantry, allowing items to be added, distributed to
students, and searched.
System Requirements:
Pantry Item Management:
Make a class PantryItem with attributes: name, quantity, and expiryDate.
Use an ArrayList to store PantryItem objects.
Adding Items:
Implement a method to add items to the pantry. If an item already exists, update
the quantity.
Distributing Items:
Implement a method to distribute items to students. If the requested quantity
exceeds availability, distribute the available quantity and update the inventory.
Searching for Items:
Implement a method to search for items by name. Return the item details if found,
otherwise indicate that the item is not available.
User Interface:
Develop a textbased menu interface to interact with the system. The interface
should include options to add items, distribute items, search for items, and exit the
program.
Edge Cases to Consider:
Adding an item that already exists.
Requesting more items than available.
Searching for items not in the pantry.
Handling invalid inputs gracefully.
Sample Program Flow:
Start the program and display the menu.
Select an option Add Item, Distribute Item, Search Item, Exit
Perform the selected action and display the result.
Repeat until the user chooses to exit.
Sample Output:
Welcome to the Food Pantry Management System
Add Item
Distribute Item
Search Item
Exit
Enter your choice:
Enter item name: Apples
Enter quantity:
Enter expiry date YYYYMMDD:
Item added successfully!
Add Item
Distribute Item
Search Item
Exit
Enter your choice:
Enter item name: Apples
Enter quantity:
Apples distributed successfully!
Add Item
Distribute Item
Search Item
Exit
Enter your choice:
Enter item name: Apples
Item: Apples, Quantity: Expiry Date:
Add Item
Distribute Item
Search Item
Exit
Enter your choice:
Goodbye!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started