This project is a simple Hotel Room Reservation System implemented in Java. It simulates room allocation using Stacks and Queues, mimicking real-world hotel booking behavior and waiting lines.
.
βββ Main.java # Entry point for the program
βββ Room.java # Room class definition
βββ Reservation.java # Reservation class definition
βββ HotelSystem.java # Core logic for room allocation, queue handling, etc.
βββ reservations.txt # Sample reservation input (CSV format)
- Room types:
Single,Double,Suite, andDeluxe - Stack-based room allocation (LIFO)
- Queue-based waiting list when rooms are full (FIFO)
- Odd-numbered room release simulation
- Dynamic reallocation from waiting queues
- Final status report for room availability
- Rooms are initialized and pushed to stacks by type.
- Reservations are read from a
reservations.txtfile. - Reservations are either immediately allocated or placed in queues.
- Booked odd-numbered rooms are released mid-process.
- Re-check waiting queues after room releases.
- The system outputs detailed logs at each step.
The input file must be named reservations.txt and follow this structure:
Reservation ID,Customer Name,Room Type
1,John Smith,Single
2,Ethan Thomas,Double
...You can run the system via the Main class:
javac *.java
java Main=== Initial Room Piles (Top -> Bottom) ===
Single Stack:
Room#5 (Single) - Available
...
Suite Stack:
Room#15 (Suite) - Available
...
=== Waiting Lines after processing waiting queues ===
Double Queue: [ReservationID: 30, Customer: Grace Baker, RoomType: Double]
...
=== Final Room Status ===
-- Unavailable Rooms --
Room#2 (Single) - Unavailable
...
-- Available Rooms --
Room#1 (Single) - Available
...
- Java (Core Java, Collections API)
- Stack, Queue, List, Map
- File I/O (Scanner)
- Data Structures (Stack, Queue, HashMap)
- Object-Oriented Programming
- File Handling in Java
- Simulation & Process Modeling
This project is for educational use. Feel free to use or modify it for learning or academic purposes.