Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Use Hashtable ( no need to implement your own code, you can use Java Hashtable ) to store information about shelters. 2 . Implement methods

Use Hashtable (no need to implement your own code, you can use Java Hashtable) to
store information about shelters.
2. Implement methods to add, update, and search for shelter information.
3. Ensure the main method does not exceed 30 lines of code.
4. Implement the project correctly.
Add meaningful identifiers, consistent indentation, explanatory comments, and properly formatted output.
B. Description
You are tasked with developing a Homeless Shelter Management System. This system will help
manage information about shelters, allowing details to be added, updated, and searched.
System Requirements
1. Shelter Information Management:
- Make a class Shelter with attributes: name, location, capacity,
availableBeds, and contactInfo.
- Use a Hashtable to store Shelter objects with the shelter name as the key.
2. Adding Shelter Information:
- Implement a method to add shelter information to the system. If a shelter already
exists, update its information.
3. Updating Shelter Information:
- Implement a method to update the available beds in a shelter. Ensure that the
available beds do not exceed the capacity.
4. Searching for Shelter Information:
- Implement a method to search for shelters by name. Return the shelter details if
found; otherwise, indicate that the shelter is not available.
5. User Interface:
- Develop a text-based menu interface to interact with the system. The interface
should include options to add shelter information, update available beds, search
for shelters, and exit the program.
Sample Program Flow
1. Start the program and display the menu.
2. Select an option (Add Shelter, Update Available Beds, Search Shelter, Exit).
3. Perform the selected action and display the result.
4. Repeat until the user chooses to exit.
Sample Output:
Welcome to the Homeless Shelter Management System
--------------------------------------------------
1. Add Shelter
2. Update Available Beds
3. Search Shelter
4. Exit
Enter your choice: 1
Enter shelter name: Hope Shelter
Enter location: 1234 Hope St
Enter capacity: 100
Enter available beds: 80
Enter contact info: 555-1234
Shelter added successfully!
1. Add Shelter
2. Update Available Beds
3. Search Shelter
4. Exit
Enter your choice: 2
Enter shelter name: Hope Shelter
Enter available beds: 70
Available beds updated successfully!
1. Add Shelter
2. Update Available Beds
3. Search Shelter
4. Exit
Enter your choice: 3
Enter shelter name: Hope Shelter
Shelter: Hope Shelter, Location: 1234 Hope St, Capacity: 100, Available Beds:
70, Contact Info: 555-1234
1. Add Shelter
2. Update Available Beds
3. Search Shelter
4. Exit
Enter your choice: 4
Goodbye!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions