A comprehensive console-based hotel reservation management system built in Java, designed to handle hotel operations, user authentication, and reservation management with role-based access control.
This application provides a complete hotel management solution with separate functionalities for administrators and regular users. The system allows users to register accounts, browse available hotels, make reservations, and manage their bookings through an intuitive console interface.
- User Registration: Create new user accounts with email validation
- User Login: Secure login system with credential verification
- Profile Management: Update email and password
- Role-based Access: Separate admin and user roles with different permissions
- Session Management: Secure logout functionality
- View Hotels: Browse all available hotels with details
- Hotel Search: Find specific hotels by ID
- Hotel Information: Display hotel name, address, available rooms, rating, and status
- Create Hotels: Add new hotels to the system
- Update Hotels: Modify hotel information (name, address, room count)
- Delete Hotels: Remove hotels from the system with confirmation
- Make Reservations: Book hotel rooms for specified number of nights
- View My Reservations: See personal reservation history
- Update Reservations: Modify number of nights for existing bookings
- Cancel Reservations: Cancel bookings with confirmation
- Delete Reservations: Remove reservation records
- View All Reservations: Access complete reservation database
- System-wide Management: Oversee all user reservations
The application follows a clean, layered architecture pattern:
src/
├── Main.java # Application entry point
├── models/ # Data models
│ ├── Client.java # User/Admin model
│ ├── Hotel.java # Hotel entity model
│ └── Reservation.java # Reservation entity model
├── repositories/ # Data access layer
│ ├── ClientRepository.java
│ ├── HotelRepository.java
│ ├── ReservationRepository.java
│ └── memory/ # In-memory implementations
│ ├── InMemoryClientRepository.java
│ ├── InMemoryHotelRepository.java
│ └── InMemoryReservationRepository.java
├── services/ # Business logic layer
│ ├── AuthService.java
│ ├── HotelService.java
│ ├── ReservationService.java
│ └── implementation/ # Service implementations
│ ├── AuthServicesImplementation.java
│ ├── HotelServiceImplementation.java
│ └── ReservationServiceImplementation.java
├── ui/ # User interface layer
│ └── ConsoleUI.java # Console-based user interface
└── utils/ # Utility classes
├── ConsoleInput.java # Input handling and validation
└── InputValidator.java # Data validation utilities
- Repository Pattern: Abstracts data access with in-memory implementations
- Service Layer Pattern: Separates business logic from presentation
- Dependency Injection: Loose coupling between components
- Interface Segregation: Clear contracts between layers
- Java Development Kit (JDK) 8 or higher
- Console/Terminal access
-
Clone the repository:
git clone https://github.com/Pood16/Hotel_management_system.git cd Hotel_management_system -
Compile the application:
javac -d bin src/**/*.java
-
Run the application:
java -cp bin Main
The system automatically creates an admin account on startup:
- Email:
admin@admin.com - Password:
admin123 - Role: Administrator
The admin account also creates three sample hotels:
- Youcode Nador (2 rooms, rating: 5.0)
- Youcode Youssoufia (10 rooms, rating: 5.0)
- Youcode Safi (10 rooms, rating: 5.0)
- Start Application: Launch the console application
- Authentication: Login with existing account or register new account
- Browse Hotels: View available hotels and their details
- Make Reservations: Select hotels and specify number of nights
- Manage Bookings: View, update, or cancel existing reservations
- Admin Login: Use admin credentials to access administrative features
- Hotel Management: Create, update, or delete hotels
- Reservation Oversight: View all system reservations
- User Management: Monitor user activities and reservations
- Password Validation: Minimum 6 characters required
- Email Validation: Proper email format enforcement
- Input Sanitization: Comprehensive input validation
- Role-based Access Control: Admin-only features protected
- Confirmation Prompts: Destructive actions require explicit confirmation
Currently uses in-memory storage for all data:
- Data persists only during application runtime
- All information is lost when application closes
- Suitable for demonstration and testing purposes