The Guest class represents a guest of the hotel, with properties such as ID, name, email, and phone number.
The Room class represents a room in the hotel, with properties like ID, room type, price, and status. It provides methods to book, check-in, and check-out a room.
The RoomType enum represents the different types of rooms available in the hotel.
The RoomStatus enum represents the status of a room, which can be available, booked, or occupied.
The Reservation class represents a reservation made by a guest for a specific room and date range. It contains properties such as ID, guest, room, check-in date, check-out date, and status. It provides a method to cancel a reservation.
The ReservationStatus enum represents the status of a reservation, which can be confirmed or cancelled.
The Payment interface defines the contract for processing payments. It is implemented by concrete payment classes like CashPayment and CreditCardPayment.
The HotelManagementSystem class is the central component of the hotel management system. It follows the Singleton pattern to ensure only one instance of the system exists. It provides methods to add guests and rooms, book rooms, cancel reservations, check-in, check-out, and process payments. It also handles concurrent access to shared resources using synchronization.
The HotelManagementSystemDemo class demonstrates the usage of the hotel management system by creating guests, rooms, booking a room, checking in, checking out, and cancelling a reservation.