This is a Hotel Management System built using Java Swing for the GUI and MySQL for backend database operations. The system is modular and includes functionality for customer registration, booking, billing, and service management.
.
├── Driver.java # Main entry point to launch the application
├── gui/ # Contains all GUI classes (Signup, Login, Dashboards)
└── service/ # Service classes handling business logic and database access
- Java (JDK 8+)
- Java Swing (GUI)
- MySQL (Database)
- JDBC (Database Connectivity)
- User registration and login
- Customer and admin dashboards
- Booking and billing services
- Room management
- Responsive GUI forms using Swing
- Clone or download this repository.
- Import the project into your IDE (like IntelliJ IDEA or Eclipse).
- Set up the MySQL database (see below).
- Update the DB credentials in the
DatabaseUtilclass. - Compile and run
Driver.java.
Run the following SQL commands in your MySQL environment:
CREATE DATABASE hotel_db;
USE hotel_db;
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL UNIQUE,
password VARCHAR(100) NOT NULL,
role VARCHAR(20) DEFAULT 'customer'
);
CREATE TABLE rooms (
id INT AUTO_INCREMENT PRIMARY KEY,
branch_id INT NOT NULL,
room_type VARCHAR(50) NOT NULL,
price DECIMAL(10,2) NOT NULL,
is_available TINYINT(1) DEFAULT 1,
FOREIGN KEY (branch_id) REFERENCES branches(id)
);
CREATE TABLE bookings (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
room_id INT NOT NULL,
checkin_date DATE NOT NULL,
checkout_date DATE NOT NULL,
total_cost DECIMAL(10,2) NOT NULL,
FOREIGN KEY (user_id) REFERENCES users(id),
FOREIGN KEY (room_id) REFERENCES rooms(id)
);
CREATE TABLE guests (
id INT AUTO_INCREMENT PRIMARY KEY,
booking_id INT NOT NULL,
name VARCHAR(100) NOT NULL,
FOREIGN KEY (booking_id) REFERENCES bookings(id)
);
CREATE TABLE hotel_branches (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100) NOT NULL,
location VARCHAR(100)
);
-
Admin:
- Username: admin
- Password: admin123
-
Customer:
- Register via the Signup form
- Make sure MySQL is running and accessible on your machine.
- Modify
DatabaseUtil.javato match your DB username, password, and URL.