Hotel Management Project

Download as pdf or txt
Download as pdf or txt
You are on page 1of 126

ABSTRACT

In my project “Hotel Management System” I have tried to show how


the data/information in hotels is managed. This is just an overview of
management in hotels. It manages and maintains the records of
customers, rooms, employees and drivers in the hotel. The project is
aimed to maintain the day-to-day state of admission/vacation of
Residents, List of employees, room details etc. Main objective of this
project is to provide solution for hotel to manage most there work using
computerized process. This software application will help admin to
handle customer information, room allocation details, Payment details
etc.
The rooms have different categories like single bed, double bed etc. so
their charges and records will be maintained accordingly.
This software has been made in a user friendly interface, so that anyone
can add, delete, update the entries and handle all the transactions easily.
As a security I have provided Admin username and Password.

3
TABLE OF CONTENT

1. Introduction

Objective

Feature

2. Analysis

History of Hotel Management System

Cost Benefit Analysis

Contribution of Hotel Management System

Advantages of Hotel Management System

Drawbacks in existing software

Feasibility Study

Requirement Specification

3. Design Phase

Class Diagram

ER Diagram

FLowchart

Sequence Diagram

4. Coding Phase with respective screenshots and database

5. Testing Phase

6. Future Scope

7. References

4
INTRODUCTION
In my project “Hotel Management System” I have tried to show how the
data/information in hotels is managed. This is just an overview of management in hotels.
It manages and maintains the records of customers, rooms, employees and drivers in the
hotel. The project is aimed to maintain the day-to-day state of admission/vacation of
Residents, List of employees, room details etc. Main objective of this project is to
provide a solution for hotels to manage most their work using computerized processes.
This software application will help admin to handle customer information, room
allocation details, Payment details etc.
The rooms have different categories like single bed, double bed etc. so their charges and
records will be maintained accordingly.
This software has been made in a user friendly interface, so that anyone can add, delete,
update the entries and handle all the transactions easily. As a security I have provided
Admin username and Password.
The project, Hotel Management System is a desktop-based application that allows the
hotel manager to handle all hotel activities online. Interactive GUI and the ability to
manage various rooms, employees, drivers and customers make this system very flexible
and convenient. This application gives managers the power and flexibility to manage the
entire system from a single online system. Hotel management project provides room
booking, staff management and other necessary hotel management features. The system
allows the manager to post available rooms in the system.

5
OBJECTIVE
The objective of the Hotel Management System is to develop a project which maintains
booking of rooms, providing drivers, etc. It is a windows based application to be
implemented in Java
The Purpose of the whole process is to ease the daily or regular activities of the Hotel
Management into an automatic computerized retrievable process. The daily activities
includes the Room activities, Entering details of the new customer check in, To allocate a
room as per the customer need and interest, Recording the checkout time and details,
Releasing or Empty of room and to record the process in a computer system for future.
Main objective of this project is to provide a solution for hotels to manage most their
work using computerized processes. This software application will help admin to handle
customer information, room allocation details, Payment details etc.
● Keeping records of admission of customers.
● Facilities provided by hotels are fully utilized in an effective and efficient manner.

FEATURM

1. Hotel Room Bookings and Reservation


2. Front Desk Operations
3. Managing Guest Profile
4. User Privilege and security control
5. Keeping a tab on guest check-in check-out status
6. Maintenance of hotel rooms.
7. Providing a user friendly interface.

6
ANALYSIS

Study Of Current System-

Current System of Hotel Management is fully based on paperwork. Hotel Management has to manage all
records of customers and rooms on paper.

Problem and Weakness Of Current System-

Paperwork is a tedious job. There can be delay and the problem of human error in allocating rooms and
providing resources.

HISTORY

Hotel Management Systems are able to automate the process of hotels. It is useful for authorities which
keep track of all the users registered. The authority can hotel packages room detail and availability of
rooms, online booking and other packages.

The following steps that give detailed information of the need for electronic managements are:

Performance

During the past several decades, the records are supposed to be manually handled for all activities. The
manual handling of records is time consuming and highly prone to error. To improve the performance of
the hotel management system, the computerized system had to be undertaken.

Efficiency

The basic need of this application is efficiency. The website should be efficient so that whatever the user
submits any detail the application is updated immediately and automatically. These records will be useful
for others instantly.

7
Control

The complete control of the electronic system is under the hands of authorized persons who have the
password to access the system and illegal access is not permitted. Control is entirely in the hands of the
administrator and the other members have the right to see the records not to change any transaction entry.

Security

Security is the main criteria for electronic hotel management systems. Since illegal access may corrupt the
database and ensure protection of the stored data.

Cost Benefit Analysis

● Role Based Screen Access


● The roles can be any of the following:
● Administrator Role - is for provisioning of Register/Update/Remove/Transfer Contract.
● Data Entry role – for entering of basic form data
● Supervisory role – for review/approval/rejection/modification of data
● Decision making role – viewing of report and decision making

8
Contribution

Hotel Management Software is programmed to enable HR professionals for managing the data and
information of the company’s employees on a regular basis. The easy information regarding the
employees is including contact details, investment details, and much more.

Accuracy:

Your system must be able to accommodate your employees and various customers or guests at your hotel.
Once a good system is in place, you will have an accurate record of the check-in and check-out status of a
customer. An automated system minimizes the possibility of human error, as the only real factor is
whether employees remember to clock in and out.

Record-Keeping:

Another feature of a hotel management system is that it can be used to keep detailed and accurate records.
These records can be stored in a main database on site,online or in an outside record-keeping facility.
Record-keeping can help you monitor trends such as how much overtime you're paying and how many
employees participate in your company retirement plans

9
ADVANTAGM OF HOTEL MANAGEMENT SYSTEM
● Sometime it happens that the rooms get booked soon when one visits the place
therefore user can make advance booking using this system.
● It saves user time in searching a room.
● The system is useful as it calculates an exact cost of rooms for requested
number of days.
● It saves organization resources and expenses.
● This system is effective and saves time and cost of users.
● It is less time consuming and provides maximum accuracy.

DRAWBACKS OF HOTEL MANAGEMENT SYSTEM


● The booking process usually requires a customer identity, which the system
cannot detect.
● It requires a reliable internet connection

10
Feasibility Study
To analyze whether the software will meet organizational requirements Feasibility isdefined as the
practical extent to which a project can be performed successfully. Toevaluate feasibility, a feasibility study
is performed.

To determine whether the software can be implemented using the current technology and within the
specified budget and schedule A feasibility study is a preliminary investigation of a proposed system to
decide whether the system can run smoothly with the organization.

To determine whether the software can be integrated with other existing software.benefits that are
expected and to decide will the organization go for it.

Three Types of feasibility study


1. Technical Feasibility.
Ascertains that the technology chosen for software development has a large number of
users so that they can be consulted when problems arise or improvements are required

2. Operational Feasibility.

Analyzes whether users will adapt to a new software.Determines whether the organization is satisfied by
the alternative solutions proposed by the software development team

3. Economical Feasibility

Cost of hardware, software, development team, and training. Feasible only if tangible and intangible
benefits outweigh the cost. The cost for proposed online shopping system is outweighing the cost and
efforts involved

11
REQUIREMENT SPECIFICATION

User Requirements

There should be software which allocates rooms automatically and maintains records of
customers.

System Requirements

There should be a database backup of the hotel management system. There should be a
Java supported framework for the system. Operating system should be WindowsXP or a
higher version of windows.

User Interface
The User interface required to be developed for the system should be user friendly and
attractive.
There are two sets of java APIs for graphics programming:
AWT (Abstract Windowing Toolkit) and Swing.
□ AWT API was introduced in JDK 1.0. Most of the AWT components have become
obsolete and should be replaced by newer Swing components.

□ Swing API, a much more comprehensive set of graphics libraries that enhances the
AWT, was introduced as part of Java Foundation Classes (JFC) after the release of
JDK 1.1. JFC consists of Swing, Java2D, Accessibility, Internationalization, and
Pluggable Look-and-Feel Support APIs. JFC was an add-on to JDK 1.1 but has been
integrated into core Java since JDK 1.2.

For the development of this project both hardware and software were required. The hard
required is any machine compatible for running the softwares and resources required.

Software Requirements

● Operating System Windows 10


● Front End Java, NetBeans
● Back End MySQL

12
Hardware Requirements

● Desktop PC or a Laptop
● Printer
● Operating System – Windows 10
● Intel® CoreTM i3-6006U CPU @ 2.00GHz
● 4.00 GB RAM
● 64-bit operating system, x64 based processor
● 1024 x 768 monitor resolution
● Keyboard and Mouse

13
Class Diagram

14
ER Diagram

14
Flowchart

15
CODE
Connection
package hotel.management.system;

import java.sql.*;

public class conn {

public Connection conn;

public Statement s;

public PreparedStatement pstmt;

public conn(){

try{

Class.forName("com.mysql.cj.jdbc.Driver");

String connectionurl="jdbc:mysql://localhost:3306/hms?user=root&password=9029059791";

conn=DriverManager.getConnection(connectionurl);

System.out.println("Connected");

s = conn.createStatement();

}catch(Exception e) {

e.printStackTrace();

16
Hotel Management System (Main Page)
package hotel.management.system;

import java.awt.*;

import javax.swing.*;

import java.awt.event.*;

public class HotelManagementSystem extends JFrame implements ActionListener{

JLabel l1;

JButton b1;

public HotelManagementSystem() {

setSize(1366,430); // setContentPane(300,300,1366,390); frame size

setLayout(null);

setLocation(300,300);

l1 = new JLabel("");

b1 = new JButton("Next");

b1.setBackground(Color.WHITE);

b1.setForeground(Color.BLACK);

ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/first.jpg"));

Image i3 = i1.getImage().getScaledInstance(1366, 390,Image.SCALE_DEFAULT);

ImageIcon i2 = new ImageIcon(i3);

l1 = new JLabel(i2);

JLabel lid=new JLabel("HOTEL MANAGEMENT SYSTEM");

lid.setBounds(30,300,1500,100);

lid.setFont(new Font("serif",Font.PLAIN,70));

lid.setForeground(Color.red);

17
l1.add(lid);

b1.setBounds(1170,325,150,50);

l1.setBounds(0, 0, 1366, 390);

l1.add(b1);

add(l1);

b1.addActionListener(this);

setVisible(true);

while(true){

lid.setVisible(false); // lid = j label

try{

Thread.sleep(500); //1000 = 1 second

}catch(Exception e){}

lid.setVisible(true);

try{

Thread.sleep(500);

}catch(Exception e){}

public void actionPerformed(ActionEvent ae){

new Login().setVisible(true);

this.setVisible(false);

public static void main(String[] args) {

HotelManagementSystem window = new HotelManagementSystem();

window.setVisible(true);

18
}

19
Login
package hotel.management.system;

import java.awt.*;

import javax.swing.*;

import java.awt.event.*;

import java.sql.*;

public class Login extends JFrame implements ActionListener{

JLabel l1,l2;

JTextField t1;

JPasswordField t2;

JButton b1,b2;

Login(){

super("Login");

setLayout(null);

l1 = new JLabel("Username");

l1.setBounds(40,20,100,30);

add(l1);

l2 = new JLabel("Password");

l2.setBounds(40,70,100,30);

add(l2);

t1=new JTextField();

t1.setBounds(150,20,150,30);

add(t1);

t2=new JPasswordField();

t2.setBounds(150,70,150,30);

20
add(t2);

ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/second.jpg"));

Image i2 = i1.getImage().getScaledInstance(200,200,Image.SCALE_DEFAULT);

ImageIcon i3 = new ImageIcon(i2);

JLabel l3 = new JLabel(i3);

l3.setBounds(350,10,150,150);

add(l3);

b1 = new JButton("Login");

b1.setBounds(40,140,120,30);

b1.setFont(new Font("serif",Font.BOLD,15));

b1.addActionListener(this);

b1.setBackground(Color.BLACK);

b1.setForeground(Color.WHITE);

add(b1);

b2=new JButton("Cancel");

b2.setBounds(180,140,120,30);

b2.setFont(new Font("serif",Font.BOLD,15));

b2.setBackground(Color.BLACK);

b2.setForeground(Color.WHITE);

add(b2);

b2.addActionListener(this);

getContentPane().setBackground(Color.WHITE);

setVisible(true);

setSize(600,300);

21
setLocation(600,350);

public void actionPerformed(ActionEvent ae){

if(ae.getSource()==b1){

try{

conn c1 = new conn();

String u = t1.getText();

String v = t2.getText();

String q = "select * from login where username='"+u+"' and password='"+v+"'";

ResultSet rs = c1.s.executeQuery(q);

if(rs.next()){

new Dashboard().setVisible(true);

setVisible(false);

}else{

JOptionPane.showMessageDialog(null, "Invalid login");

setVisible(false);

}catch(Exception e){

e.printStackTrace();

}else if(ae.getSource()==b2){

System.exit(0);

public static void main(String[] arg){

22
new Login();

23
Dashboard
package hotel.management.system;

import java.awt.*;

import javax.swing.*;

import java.awt.event.*;

public class Dashboard extends JFrame{

public static void main(String[] args) {

new Dashboard().setVisible(true);

public Dashboard() {

super("HOTEL MANAGEMENT SYSTEM");

setForeground(Color.CYAN);

setLayout(null);

ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/third.jpg"));

Image i2 = i1.getImage().getScaledInstance(1950, 1000,Image.SCALE_DEFAULT);

ImageIcon i3 = new ImageIcon(i2);

JLabel NewLabel = new JLabel(i3);

NewLabel.setBounds(0, 0, 1950, 1000);

add(NewLabel);

JLabel AirlineManagementSystem = new JLabel("THE TAJ GROUP WELCOMES YOU");

AirlineManagementSystem.setForeground(Color.WHITE);

AirlineManagementSystem.setFont(new Font("Tahoma", Font.PLAIN, 46));

AirlineManagementSystem.setBounds(600, 60, 1000, 85);

NewLabel.add(AirlineManagementSystem);

24
JMenuBar menuBar = new JMenuBar();

setJMenuBar(menuBar);

JMenu AirlineSystem = new JMenu("HOTEL MANAGEMENT");

AirlineSystem.setForeground(Color.BLUE);

menuBar.add(AirlineSystem);

JMenuItem FlightDetails = new JMenuItem("RECEPTION");

AirlineSystem.add(FlightDetails);

JMenu AirlineSystemHello = new JMenu("ADMIN");

AirlineSystemHello.setForeground(Color.RED);

menuBar.add(AirlineSystemHello);

JMenuItem FlightDetailshello1 = new JMenuItem("ADD EMPLOYEE");

AirlineSystemHello.add(FlightDetailshello1);

FlightDetailshello1.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent ae){

try{

new AddEmployee().setVisible(true);

}catch(Exception e ){}

});

JMenuItem FlightDetailshello2 = new JMenuItem("ADD ROOMS");

AirlineSystemHello.add(FlightDetailshello2);

FlightDetailshello2.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent ae){

try{

new AddRoom().setVisible(true);

25
}catch(Exception e ){}

});

FlightDetails.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent ae){

new Reception();

});

JMenuItem FlightDetailshello3 = new JMenuItem("ADD DRIVERS");

AirlineSystemHello.add(FlightDetailshello3);

FlightDetailshello3.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent ae){

try{

new AddDrivers().setVisible(true);

}catch(Exception e ){}

});

setSize(1950,1090);

setVisible(true);

getContentPane().setBackground(Color.WHITE);

26
27
Reception
package hotel.management.system;

import javax.swing.*;

import java.sql.*;

import java.awt.event.*;

import java.awt.*;

public class Reception extends JFrame {

private JPanel contentPane;

public static void main(String[] args) {

new Reception();

public Reception(){

setBounds(530, 200, 850, 570);

contentPane = new JPanel();

setContentPane(contentPane);

contentPane.setLayout(null);

ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/fourth.jpg"));

Image i3 = i1.getImage().getScaledInstance(500, 500,Image.SCALE_DEFAULT);

ImageIcon i2 = new ImageIcon(i3);

JLabel l1 = new JLabel(i2);

l1.setBounds(250,30,500,470);

add(l1);

JButton btnNewCustomerForm = new JButton("New Customer Form");

btnNewCustomerForm.addActionListener(new ActionListener() {

28
public void actionPerformed(ActionEvent e) {

try{

NewCustomer custom = new NewCustomer();

custom.setVisible(true);

setVisible(false);

}catch(Exception e1){

e1.printStackTrace();

});

btnNewCustomerForm.setBounds(10, 30, 200, 30);

btnNewCustomerForm.setBackground(Color.BLACK);

btnNewCustomerForm.setForeground(Color.WHITE);

contentPane.add(btnNewCustomerForm);

JButton btnNewButton = new JButton("Room");

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent arg0) {

try{

Room room = new Room();

room.setVisible(true);

setVisible(false);

catch(Exception e){

e.printStackTrace();

29
}

});

btnNewButton.setBounds(10, 70, 200, 30);

btnNewButton.setBackground(Color.BLACK);

btnNewButton.setForeground(Color.WHITE);

contentPane.add(btnNewButton);

JButton btnNewButton_1 = new JButton("Department");

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

try{

Department dept = new Department();

dept.setVisible(true);

setVisible(false);

catch (Exception e1){

e1.printStackTrace();

});

btnNewButton_1.setBounds(10, 110, 200, 30);

btnNewButton_1.setBackground(Color.BLACK);

btnNewButton_1.setForeground(Color.WHITE);

contentPane.add(btnNewButton_1);

JButton btnNewButton_2 = new JButton("All Employee Info");

btnNewButton_2.addActionListener(new ActionListener() {

30
public void actionPerformed(ActionEvent e) {

try{

Employee em = new Employee();

em.setVisible(true);

setVisible(false);

catch (Exception e1){

e1.printStackTrace();

});

btnNewButton_2.setBounds(10, 150, 200, 30);

btnNewButton_2.setBackground(Color.BLACK);

btnNewButton_2.setForeground(Color.WHITE);

contentPane.add(btnNewButton_2);

JButton btnNewButton_3 = new JButton("Customer Info");

btnNewButton_3.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

try{

//error

CustomerInfo customer = new CustomerInfo();

customer.setVisible(true);

setVisible(false);

catch (Exception e1){

31
e1.printStackTrace();

});

btnNewButton_3.setBounds(10, 190, 200, 30);

btnNewButton_3.setBackground(Color.BLACK);

btnNewButton_3.setForeground(Color.WHITE);

contentPane.add(btnNewButton_3);

JButton btnManagerInfo = new JButton("Manager Info");

btnManagerInfo.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

try{

ManagerInfo mana = new ManagerInfo();

mana.setVisible(true);

setVisible(false);

catch (Exception e1){

e1.printStackTrace();

});

btnManagerInfo.setBounds(10, 230, 200, 30);

btnManagerInfo.setBackground(Color.BLACK);

btnManagerInfo.setForeground(Color.WHITE);

contentPane.add(btnManagerInfo);

32
JButton btnNewButton_4 = new JButton("Check Out");

btnNewButton_4.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

CheckOut check;

try {

check = new CheckOut();

check.setVisible(true);

setVisible(false);

} catch (SQLException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

});

btnNewButton_4.setBounds(10, 270, 200, 30);

btnNewButton_4.setBackground(Color.BLACK);

btnNewButton_4.setForeground(Color.WHITE);

contentPane.add(btnNewButton_4);

JButton btnNewButton_5 = new JButton("Update Check Status");

btnNewButton_5.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

try{

UpdateCheck update = new UpdateCheck();

update.setVisible(true);

setVisible(false);

33
}

catch(Exception e1){

e1.printStackTrace();

});

btnNewButton_5.setBounds(10, 310, 200, 30);

btnNewButton_5.setBackground(Color.BLACK);

btnNewButton_5.setForeground(Color.WHITE);

contentPane.add(btnNewButton_5);

JButton btnNewButton_6 = new JButton("Update Room Status");

btnNewButton_6.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

try{

UpdateRoom room = new UpdateRoom();

room.setVisible(true);

setVisible(false);

}catch(Exception s)

s.printStackTrace();

});

btnNewButton_6.setBounds(10, 350, 200, 30);

btnNewButton_6.setBackground(Color.BLACK);

34
btnNewButton_6.setForeground(Color.WHITE);

contentPane.add(btnNewButton_6);

JButton btnPickUpSerice = new JButton("Pick up Service");

btnPickUpSerice.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent arg0) {

try{

PickUp pick = new PickUp();

pick.setVisible(true);

setVisible(false);

catch(Exception e){

e.printStackTrace();

});

btnPickUpSerice.setBounds(10, 390, 200, 30);

btnPickUpSerice.setBackground(Color.BLACK);

btnPickUpSerice.setForeground(Color.WHITE);

contentPane.add(btnPickUpSerice);

JButton btnSearchRoom = new JButton("Search Room");

btnSearchRoom.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

try {

SearchRoom search = new SearchRoom();

search.setVisible(true);

35
setVisible(false);

catch (Exception ss){

ss.printStackTrace();

});

btnSearchRoom.setBounds(10, 430, 200, 30);

btnSearchRoom.setBackground(Color.BLACK);

btnSearchRoom.setForeground(Color.WHITE);

contentPane.add(btnSearchRoom);

JButton btnNewButton_7 = new JButton("Log Out");

btnNewButton_7.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

try {

new Login().setVisible(true);

setVisible(false);

} catch (Exception e) {

e.printStackTrace();

});

btnNewButton_7.setBounds(10, 470, 200, 30);

btnNewButton_7.setBackground(Color.BLACK);

btnNewButton_7.setForeground(Color.WHITE);

36
contentPane.add(btnNewButton_7);

getContentPane().setBackground(Color.WHITE);

setVisible(true);

37
New Customer Form
package hotel.management.system;

import java.awt.BorderLayout;

import java.awt.*;

import java.awt.EventQueue;

import javax.swing.border.EmptyBorder;

import java.awt.Font;

import java.awt.Image;

import java.sql.*;

import javax.swing.*;

import java.awt.event.ActionListener;

import java.awt.event.ActionEvent;

public class NewCustomer extends JFrame {

Connection conn = null;

PreparedStatement pst = null;

private JPanel contentPane;

private JTextField t1,t2,t3,t4,t5,t6;

JComboBox comboBox;

JRadioButton r1,r2;

Choice c1;

/**

* Launch the application.

*/

public static void main(String[] args) {

EventQueue.invokeLater(new Runnable() {

38
public void run() {

try {

NewCustomer frame = new NewCustomer();

frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

});

public NewCustomer() throws SQLException {

setBounds(530, 200, 850, 550);

contentPane = new JPanel();

setContentPane(contentPane);

contentPane.setLayout(null);

ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/fifth.png"));

Image i3 = i1.getImage().getScaledInstance(300, 400,Image.SCALE_DEFAULT);

ImageIcon i2 = new ImageIcon(i3);

JLabel l1 = new JLabel(i2);

l1.setBounds(480,10,300,500);

add(l1);

JLabel lblName = new JLabel("NEW CUSTOMER FORM");

lblName.setFont(new Font("Yu Mincho", Font.PLAIN, 20));

lblName.setBounds(118, 11, 260, 53);

39
contentPane.add(lblName);

JLabel lblId = new JLabel("ID :");

lblId.setBounds(35, 76, 200, 14);

contentPane.add(lblId);

comboBox = new JComboBox(new String[] {"Passport", "Aadhar Card", "Voter Id", "Driving
license"});

comboBox.setBounds(271, 73, 150, 20);

contentPane.add(comboBox);

JLabel l2 = new JLabel("Number :");

l2.setBounds(35, 111, 200, 14);

contentPane.add(l2);

t1 = new JTextField();

t1.setBounds(271, 111, 150, 20);

contentPane.add(t1);

t1.setColumns(10);

JLabel lblName_1 = new JLabel("Name :");

lblName_1.setBounds(35, 151, 200, 14);

contentPane.add(lblName_1);

t2 = new JTextField();

t2.setBounds(271, 151, 150, 20);

contentPane.add(t2);

t2.setColumns(10);

JLabel lblGender = new JLabel("Gender :");

lblGender.setBounds(35, 191, 200, 14);

contentPane.add(lblGender);

40
r1 = new JRadioButton("Male");

r1.setFont(new Font("Raleway", Font.BOLD, 14));

r1.setBackground(Color.WHITE);

r1.setBounds(271, 191, 80, 12);

add(r1);

r2 = new JRadioButton("Female");

r2.setFont(new Font("Raleway", Font.BOLD, 14));

r2.setBackground(Color.WHITE);

r2.setBounds(350, 191, 100, 12);

add(r2);

JLabel lblCountry = new JLabel("Days :");

lblCountry.setBounds(35, 231, 200, 14);

contentPane.add(lblCountry);

JLabel lblReserveRoomNumber = new JLabel("Allocated Room Number :");

lblReserveRoomNumber.setBounds(35, 274, 200, 14);

contentPane.add(lblReserveRoomNumber);

c1 = new Choice();

try{

conn c = new conn();

ResultSet rs = c.s.executeQuery("select * from room");

while(rs.next()){

c1.add(rs.getString("room_number"));

}catch(Exception e){ }

c1.setBounds(271, 274, 150, 20);

41
contentPane.add(c1);

JLabel lblCheckInStatus = new JLabel("Checked-In :");

lblCheckInStatus.setBounds(35, 316, 200, 14);

contentPane.add(lblCheckInStatus);

JLabel lblDeposite = new JLabel("Deposit :");

lblDeposite.setBounds(35, 359, 200, 14);

contentPane.add(lblDeposite);

t3 = new JTextField();

t3.setBounds(271, 231, 150, 20);

contentPane.add(t3);

t3.setColumns(10);

t5 = new JTextField();

t5.setBounds(271, 316, 150, 20);

contentPane.add(t5);

t5.setColumns(10);

t6 = new JTextField();

t6.setBounds(271, 359, 150, 20);

contentPane.add(t6);

t6.setColumns(10);

JButton btnNewButton = new JButton("Add");

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

conn c = new conn();

String radio = null;

if(r1.isSelected()){

42
radio = "Male";

else if(r2.isSelected()){

radio = "Female";

String s6 = c1.getSelectedItem();

try{

String s1 = (String)comboBox.getSelectedItem();

String s2 = t1.getText();

String s3 = t2.getText();

String s4 = radio;

String s5 = t3.getText();

String s7 = t5.getText();

String s8 = t6.getText();

String q1 = "insert into customer


values('"+s1+"','"+s2+"','"+s3+"','"+s4+"','"+s5+"','"+s6+"','"+s7+"','"+s8+"')";

String q2 = "update room set availability = 'Occupied' where room_number = "+s6;

c.s.executeUpdate(q1);

c.s.executeUpdate(q2);

JOptionPane.showMessageDialog(null, "Data Inserted Successfully");

new Reception().setVisible(true);

setVisible(false);

}catch(SQLException e1){

System.out.println(e1.getMessage());

43
}

catch(NumberFormatException s){

JOptionPane.showMessageDialog(null, "Please enter a valid


Number");

});

btnNewButton.setBounds(100, 430, 120, 30);

btnNewButton.setBackground(Color.BLACK);

btnNewButton.setForeground(Color.WHITE);

contentPane.add(btnNewButton);

JButton btnExit = new JButton("Back");

btnExit.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

new Reception().setVisible(true);

setVisible(false);

});

btnExit.setBounds(260, 430, 120, 30);

btnExit.setBackground(Color.BLACK);

btnExit.setForeground(Color.WHITE);

contentPane.add(btnExit);

getContentPane().setBackground(Color.WHITE);

44
45
Room
package hotel.management.system;

import java.awt.BorderLayout;

import java.awt.*;

import javax.swing.JFrame;

import javax.swing.JPanel;

import javax.swing.border.EmptyBorder;

import net.proteanit.sql.DbUtils;

import javax.swing.JTable;

import java.sql.*;

import javax.swing.*;

import java.awt.event.ActionListener;

import java.awt.event.ActionEvent;

public class Room extends JFrame {

Connection conn = null;

private JPanel contentPane;

private JTable table;

private JLabel lblAvailability;

private JLabel lblCleanStatus;

private JLabel lblNewLabel;

private JLabel lblNewLabel_1;

private JLabel lblRoomNumber;

private JLabel lblId;

/**

* Launch the application.

46
*/

public static void main(String[] args) {

EventQueue.invokeLater(new Runnable() {

public void run() {

try {

Room frame = new Room();

frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

});

public Room() throws SQLException {

//conn = Javaconnect.getDBConnection();

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setBounds(450, 200, 1100, 600);

contentPane = new JPanel();

contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

setContentPane(contentPane);

contentPane.setLayout(null);

ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/eight.jpg"));

Image i3 = i1.getImage().getScaledInstance(600, 600,Image.SCALE_DEFAULT);

ImageIcon i2 = new ImageIcon(i3);

47
JLabel l1 = new JLabel(i2);

l1.setBounds(500,0,600,600);

add(l1);

table = new JTable();

table.setBounds(0, 40, 500, 400);

contentPane.add(table);

JButton btnLoadData = new JButton("Load Data");

btnLoadData.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

try{

conn c = new conn();

String displayCustomersql = "select * from Room";

//PreparedStatement pst =
conn.prepareStatement(displayCustomersql);

ResultSet rs = c.s.executeQuery(displayCustomersql);

table.setModel(DbUtils.resultSetToTableModel(rs));

catch(Exception e1){

e1.printStackTrace();

});

btnLoadData.setBounds(100, 470, 120, 30);

btnLoadData.setBackground(Color.BLACK);

48
btnLoadData.setForeground(Color.WHITE);

contentPane.add(btnLoadData);

JButton btnNewButton = new JButton("Back");

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

new Reception().setVisible(true);

setVisible(false);

});

btnNewButton.setBounds(290, 470, 120, 30);

btnNewButton.setBackground(Color.BLACK);

btnNewButton.setForeground(Color.WHITE);

contentPane.add(btnNewButton);

lblAvailability = new JLabel("Availability");

lblAvailability.setBounds(119, 15, 69, 14);

contentPane.add(lblAvailability);

lblCleanStatus = new JLabel("Clean Status");

lblCleanStatus.setBounds(216, 15, 76, 14);

contentPane.add(lblCleanStatus);

lblNewLabel = new JLabel("Price");

lblNewLabel.setBounds(330, 15, 46, 14);

contentPane.add(lblNewLabel);

lblNewLabel_1 = new JLabel("Bed Type");

lblNewLabel_1.setBounds(417, 15, 76, 14);

contentPane.add(lblNewLabel_1);

49
lblId = new JLabel("Room Number");

lblId.setBounds(12, 15, 90, 14);

contentPane.add(lblId);

getContentPane().setBackground(Color.WHITE);

50
Department
package hotel.management.system;

import java.awt.BorderLayout;

import java.awt.*;

import javax.swing.JFrame;

import javax.swing.JPanel;

import javax.swing.border.EmptyBorder;

import net.proteanit.sql.DbUtils;

import javax.swing.JTable;

import java.sql.*;

import javax.swing.*;

import java.awt.event.ActionListener;

import java.awt.event.ActionEvent;

public class Department extends JFrame {

Connection conn = null;

private JPanel contentPane;

private JTable table;

private JLabel lblNewLabel;

private JLabel lblNewLabel_1;

/**

* Launch the application.

*/

public static void main(String[] args) {

EventQueue.invokeLater(new Runnable() {

public void run() {

51
try {

Department frame = new Department();

frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

});

public void close()

this.dispose();

/**

* Create the frame.

* @throws SQLException

*/

public Department() throws SQLException {

//conn = Javaconnect.getDBConnection();

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setBounds(600, 200, 700, 500);

contentPane = new JPanel();

contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

setContentPane(contentPane);

contentPane.setLayout(null);

52
table = new JTable();

table.setBounds(0, 40, 700, 350);

contentPane.add(table);

JButton btnNewButton = new JButton("Load Data");

btnNewButton.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

try{

conn c = new conn();

String displayCustomersql = "select * from Department";

ResultSet rs = c.s.executeQuery(displayCustomersql);

table.setModel(DbUtils.resultSetToTableModel(rs));

catch (Exception e1){

e1.printStackTrace();

});

btnNewButton.setBounds(170, 410, 120, 30);

btnNewButton.setBackground(Color.BLACK);

btnNewButton.setForeground(Color.WHITE);

contentPane.add(btnNewButton);

JButton btnNewButton_1 = new JButton("Back");

btnNewButton_1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

new Reception().setVisible(true);

53
setVisible(false);

});

btnNewButton_1.setBounds(400, 410, 120, 30);

btnNewButton_1.setBackground(Color.BLACK);

btnNewButton_1.setForeground(Color.WHITE);

contentPane.add(btnNewButton_1);

lblNewLabel = new JLabel("Department");

lblNewLabel.setBounds(145, 11, 105, 14);

contentPane.add(lblNewLabel);

lblNewLabel_1 = new JLabel("Budget");

lblNewLabel_1.setBounds(431, 11, 75, 14);

contentPane.add(lblNewLabel_1);

getContentPane().setBackground(Color.WHITE);

54
Employee
package hotel.management.system;

import java.awt.BorderLayout;

import java.awt.*;

import javax.swing.JFrame;

import javax.swing.JPanel;

import javax.swing.border.EmptyBorder;

import net.proteanit.sql.DbUtils;

import javax.swing.JTable;

import java.sql.*;

import javax.swing.*;

import java.awt.event.ActionListener;

import java.awt.event.ActionEvent;

public class Employee extends JFrame {

Connection conn = null;

private JPanel contentPane;

private JTable table;

private JLabel lblNewLabel;

private JLabel lblJob;

private JLabel lblName;

private JLabel lblDepartment;

/**

* Launch the application.

*/

public static void main(String[] args) {

55
EventQueue.invokeLater(new Runnable() {

public void run() {

try {

Employee frame = new Employee();

frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

});

public void close()

this.dispose();

/**

* Create the frame.

* @throws SQLException

*/

public Employee() throws SQLException {

//conn = Javaconnect.getDBConnection();

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setBounds(430, 200, 1000, 600);

contentPane = new JPanel();

contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

56
setContentPane(contentPane);

contentPane.setLayout(null);

table = new JTable();

table.setBounds(0, 34, 1000, 450);

contentPane.add(table);

JButton btnLoadData = new JButton("Load Data");

btnLoadData.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

try{

conn c = new conn();

String displayCustomersql = "select * from Employee";

ResultSet rs = c.s.executeQuery(displayCustomersql);

table.setModel(DbUtils.resultSetToTableModel(rs));

catch(Exception e1){

e1.printStackTrace();

});

btnLoadData.setBounds(350, 500, 120, 30);

btnLoadData.setBackground(Color.BLACK);

btnLoadData.setForeground(Color.WHITE);

contentPane.add(btnLoadData);

JButton btnExit = new JButton("Back");

btnExit.addActionListener(new ActionListener() {

57
public void actionPerformed(ActionEvent e) {

new Reception().setVisible(true);

setVisible(false);

});

btnExit.setBounds(510, 500, 120, 30);

btnExit.setBackground(Color.BLACK);

btnExit.setForeground(Color.WHITE);

contentPane.add(btnExit);

lblNewLabel = new JLabel("Name");

lblNewLabel.setBounds(41, 11, 46, 14);

contentPane.add(lblNewLabel);

lblJob = new JLabel("Age");

lblJob.setBounds(159, 11, 46, 14);

contentPane.add(lblJob);

lblName = new JLabel("Gender");

lblName.setBounds(273, 11, 46, 14);

contentPane.add(lblName);

lblDepartment = new JLabel("Job");

lblDepartment.setBounds(416, 11, 86, 14);

contentPane.add(lblDepartment);

JLabel l1 = new JLabel("Salary");

l1.setBounds(536, 11, 86, 14);

contentPane.add(l1);

JLabel l2 = new JLabel("Phone");

58
l2.setBounds(656, 11, 86, 14);

contentPane.add(l2);

JLabel l3 = new JLabel("Aadhar");

l3.setBounds(786, 11, 86, 14);

contentPane.add(l3);

JLabel l4 = new JLabel("Gmail");

l4.setBounds(896, 11, 86, 14);

contentPane.add(l4);

getContentPane().setBackground(Color.WHITE);

59
Customer Info
package hotel.management.system;

import java.awt.BorderLayout;

import java.awt.*;

import javax.swing.JFrame;

import javax.swing.JPanel;

import javax.swing.border.EmptyBorder;

import net.proteanit.sql.DbUtils;

import java.sql.*;

import javax.swing.*;

import javax.swing.JTable;

import javax.swing.JButton;

import java.awt.event.ActionListener;

import java.awt.event.ActionEvent;

public class CustomerInfo extends JFrame {

Connection conn = null;

private JPanel contentPane;

private JLabel lblId;

private JLabel lblNewLabel;

private JLabel lblGender;

private JTable table;

private JLabel lblCountry;

private JLabel lblRoom;

private JLabel lblStatus;

private JLabel lblNewLabel_1;

60
/**

* Launch the application.

*/

public static void main(String[] args) {

EventQueue.invokeLater(new Runnable() {

public void run() {

try {

CustomerInfo frame = new CustomerInfo();

frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

});

public void close()

this.dispose();

/**

* Create the frame.

* @throws SQLException

*/

public CustomerInfo() throws SQLException {

//conn = Javaconnect.getDBConnection();

61
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setBounds(530, 200, 900, 600);

contentPane = new JPanel();

contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

setContentPane(contentPane);

contentPane.setLayout(null);

JButton btnExit = new JButton("Back");

btnExit.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

new Reception().setVisible(true);

setVisible(false);

});

btnExit.setBounds(450, 510, 120, 30);

btnExit.setBackground(Color.BLACK);

btnExit.setForeground(Color.WHITE);

contentPane.add(btnExit);

JButton btnLoadData = new JButton("Load Data");

btnLoadData.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent arg0) {

try{

conn c = new conn();

String displayCustomersql = "select * from Customer";

ResultSet rs = c.s.executeQuery(displayCustomersql);

table.setModel(DbUtils.resultSetToTableModel(rs));

62
}

catch(Exception e)

e.printStackTrace();

});

btnLoadData.setBounds(300, 510, 120, 30);

btnLoadData.setBackground(Color.BLACK);

btnLoadData.setForeground(Color.WHITE);

contentPane.add(btnLoadData);

lblId = new JLabel("ID");

lblId.setBounds(31, 11, 46, 14);

contentPane.add(lblId);

JLabel l1 = new JLabel("Number");

l1.setBounds(150, 11, 46, 14);

contentPane.add(l1);

lblNewLabel = new JLabel("Name");

lblNewLabel.setBounds(270, 11, 65, 14);

contentPane.add(lblNewLabel);

lblGender = new JLabel("Gender");

lblGender.setBounds(360, 11, 46, 14);

contentPane.add(lblGender);

table = new JTable();

table.setBounds(0, 40, 900, 450);

63
contentPane.add(table);

lblCountry = new JLabel("Country");

lblCountry.setBounds(480, 11, 46, 14);

contentPane.add(lblCountry);

lblRoom = new JLabel("Room");

lblRoom.setBounds(600, 11, 46, 14);

contentPane.add(lblRoom);

lblStatus = new JLabel("Check-in Status");

lblStatus.setBounds(680, 11, 100, 14);

contentPane.add(lblStatus);

lblNewLabel_1 = new JLabel("Deposit");

lblNewLabel_1.setBounds(800, 11, 100, 14);

contentPane.add(lblNewLabel_1);

getContentPane().setBackground(Color.WHITE);

64
Manager Info
package hotel.management.system;

import java.awt.BorderLayout;

import java.awt.*;

import javax.swing.JFrame;

import javax.swing.JPanel;

import javax.swing.border.EmptyBorder;

import net.proteanit.sql.DbUtils;

import javax.swing.JTable;

import java.sql.*;

import javax.swing.*;

import java.awt.event.ActionListener;

import java.awt.event.ActionEvent;

public class ManagerInfo extends JFrame {

Connection conn = null;

private JPanel contentPane;

private JTable table;

private JLabel lblNewLabel;

private JLabel lblJob;

private JLabel lblName;

private JLabel lblDepartment;

/**

* Launch the application.

*/

public static void main(String[] args) {

65
EventQueue.invokeLater(new Runnable() {

public void run() {

try {

ManagerInfo frame = new ManagerInfo();

frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

});

public void close()

this.dispose();

/**

* Create the frame.

* @throws SQLException

*/

public ManagerInfo() throws SQLException {

//conn = Javaconnect.getDBConnection();

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setBounds(430, 200, 1000, 600);

contentPane = new JPanel();

contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

66
setContentPane(contentPane);

contentPane.setLayout(null);

table = new JTable();

table.setBounds(0, 34, 1000, 450);

contentPane.add(table);

JButton btnLoadData = new JButton("Load Data");

btnLoadData.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

try{

conn c = new conn();

String displayCustomersql = "select * from Employee where job =


'Manager'";

ResultSet rs = c.s.executeQuery(displayCustomersql);

table.setModel(DbUtils.resultSetToTableModel(rs));

catch(Exception e1){

e1.printStackTrace();

});

btnLoadData.setBounds(350, 500, 120, 30);

btnLoadData.setBackground(Color.BLACK);

btnLoadData.setForeground(Color.WHITE);

contentPane.add(btnLoadData);

JButton btnExit = new JButton("Back");

67
btnExit.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

new Reception().setVisible(true);

setVisible(false);

});

btnExit.setBounds(510, 500, 120, 30);

btnExit.setBackground(Color.BLACK);

btnExit.setForeground(Color.WHITE);

contentPane.add(btnExit);

lblNewLabel = new JLabel("Name");

lblNewLabel.setBounds(41, 11, 46, 14);

contentPane.add(lblNewLabel);

lblJob = new JLabel("Age");

lblJob.setBounds(159, 11, 46, 14);

contentPane.add(lblJob);

lblName = new JLabel("Gender");

lblName.setBounds(273, 11, 46, 14);

contentPane.add(lblName);

lblDepartment = new JLabel("Job");

lblDepartment.setBounds(416, 11, 86, 14);

contentPane.add(lblDepartment);

JLabel l1 = new JLabel("Salary");

l1.setBounds(536, 11, 86, 14);

contentPane.add(l1);

68
JLabel l2 = new JLabel("Phone");

l2.setBounds(656, 11, 86, 14);

contentPane.add(l2);

JLabel l3 = new JLabel("Aadhar");

l3.setBounds(786, 11, 86, 14);

contentPane.add(l3);

JLabel l4 = new JLabel("Gmail");

l4.setBounds(896, 11, 86, 14);

contentPane.add(l4);

getContentPane().setBackground(Color.WHITE);

69
CheckOut
package hotel.management.system;

import java.awt.BorderLayout;

import java.awt.*;

import java.awt.EventQueue;

import java.sql.*;

import javax.swing.*;

import javax.swing.border.EmptyBorder;

import java.awt.Font;

import java.awt.event.*;

import java.awt.event.ActionEvent;

public class CheckOut extends JFrame{

Connection conn = null;

PreparedStatement pst = null;

private JPanel contentPane;

private JTextField t1;

Choice c1;

/**

* Launch the application.

*/

public static void main(String[] args) {

EventQueue.invokeLater(new Runnable() {

public void run() {

try {

CheckOut frame = new CheckOut();

70
frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

});

public void close(){

this.dispose();

/**

* Create the frame.

* @throws SQLException

*/

public CheckOut() throws SQLException {

//conn = Javaconnect.getDBConnection();

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setBounds(530, 200, 800, 294);

contentPane = new JPanel();

contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

setContentPane(contentPane);

contentPane.setLayout(null);

ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/sixth.jpg"));

Image i3 = i1.getImage().getScaledInstance(400, 225,Image.SCALE_DEFAULT);

71
ImageIcon i2 = new ImageIcon(i3);

JLabel l1 = new JLabel(i2);

l1.setBounds(300,0,500,225);

add(l1);

JLabel lblCheckOut = new JLabel("Check Out ");

lblCheckOut.setFont(new Font("Tahoma", Font.PLAIN, 20));

lblCheckOut.setBounds(70, 11, 140, 35);

contentPane.add(lblCheckOut);

JLabel lblName = new JLabel("Number :");

lblName.setBounds(20, 85, 80, 14);

contentPane.add(lblName);

c1 = new Choice();

try{

conn c = new conn();

ResultSet rs = c.s.executeQuery("select * from customer");

while(rs.next()){

c1.add(rs.getString("number"));

}catch(Exception e){ }

c1.setBounds(130, 82, 150, 20);

contentPane.add(c1);

ImageIcon i4 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/tick.png"));

Image i5 = i4.getImage().getScaledInstance(20, 20,Image.SCALE_DEFAULT);

ImageIcon i6 = new ImageIcon(i5);

72
JButton l2 = new JButton(i6);

l2.setBounds(290,82,20,20);

add(l2);

l2.addActionListener(new ActionListener(){

public void actionPerformed(ActionEvent ae){

System.out.println("Hi");

try{

conn c = new conn();

String number = c1.getSelectedItem();

ResultSet rs = c.s.executeQuery("select * from customer where number = "+number);

if(rs.next()){

System.out.println("clicked");

t1.setText(rs.getString("room_number"));

}catch(Exception e){ }

});

JLabel lblRoomNumber = new JLabel("Room Number:");

lblRoomNumber.setBounds(20, 132, 86, 20);

contentPane.add(lblRoomNumber);

t1 = new JTextField();

t1.setBounds(130, 132, 150, 20);

contentPane.add(t1);

JButton btnCheckOut = new JButton("Check Out");

btnCheckOut.addActionListener(new ActionListener() {

73
public void actionPerformed(ActionEvent e) {

String id = c1.getSelectedItem();

String s1 = t1.getText();

String deleteSQL = "Delete from customer where number = "+id;

String q2 = "update room set availability = 'Available' where room_number = "+s1;

conn c = new conn();

try{

c.s.executeUpdate(deleteSQL);

c.s.executeUpdate(q2);

JOptionPane.showMessageDialog(null, "Check Out Successful");

new Reception().setVisible(true);

setVisible(false);

}catch(SQLException e1){

System.out.println(e1.getMessage());

});

btnCheckOut.setBounds(50, 200, 100, 25);

btnCheckOut.setBackground(Color.BLACK);

btnCheckOut.setForeground(Color.WHITE);

contentPane.add(btnCheckOut);

JButton btnExit = new JButton("Back");

btnExit.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

new Reception().setVisible(true);

74
setVisible(false);

});

btnExit.setBounds(160, 200, 100, 25);

btnExit.setBackground(Color.BLACK);

btnExit.setForeground(Color.WHITE);

contentPane.add(btnExit);

getContentPane().setBackground(Color.WHITE);

75
Update Check Status
package hotel.management.system;

import java.awt.BorderLayout;

import java.awt.*;

import java.sql.*;

import javax.swing.*;

import javax.swing.border.EmptyBorder;

import java.awt.Font;

import java.awt.event.ActionListener;

import java.awt.event.ActionEvent;

public class UpdateCheck extends JFrame {

Connection conn = null;

PreparedStatement pst = null;

private JPanel contentPane;

private JTextField txt_ID;

private JTextField txt_Room;

private JTextField txt_Status;

private JTextField txt_Date;

private JTextField txt_Time;

private JTextField txt_Payment;

Choice c1, c2;

/**

* Launch the application.

*/

public static void main(String[] args) {

76
EventQueue.invokeLater(new Runnable() {

public void run() {

try {

UpdateCheck frame = new UpdateCheck();

frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

});

public void close(){

this.dispose();

/**

* Create the frame.

* @throws SQLException

*/

public UpdateCheck() throws SQLException {

//conn = Javaconnect.getDBConnection();

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setBounds(500, 200, 950, 500);

contentPane = new JPanel();

contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

setContentPane(contentPane);

77
contentPane.setLayout(null);

JLabel lblUpdateCheckStatus = new JLabel("Check-In Details");

lblUpdateCheckStatus.setFont(new Font("Tahoma", Font.PLAIN, 20));

lblUpdateCheckStatus.setBounds(124, 11, 222, 25);

contentPane.add(lblUpdateCheckStatus);

ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/nine.jpg"));

JLabel l1 = new JLabel(i1);

l1.setBounds(450,70,476,270);

add(l1);

JLabel lblNewLabel = new JLabel("ID:");

lblNewLabel.setBounds(25, 88, 46, 14);

contentPane.add(lblNewLabel);

c1 = new Choice();

try{

conn c = new conn();

ResultSet rs = c.s.executeQuery("select * from customer");

while(rs.next()){

c1.add(rs.getString("number"));

}catch(Exception e){ }

c1.setBounds(248, 85, 140, 20);

contentPane.add(c1);

JLabel lblNewLabel_1 = new JLabel("Room Number :");

lblNewLabel_1.setBounds(25, 129, 107, 14);

78
contentPane.add(lblNewLabel_1);

txt_ID = new JTextField();

txt_ID.setBounds(248, 126, 140, 20);

contentPane.add(txt_ID);

JLabel lblNewLabel_2 = new JLabel("Name : ");

lblNewLabel_2.setBounds(25, 174, 97, 14);

contentPane.add(lblNewLabel_2);

JLabel lblNewLabel_3 = new JLabel("Checked-in :");

lblNewLabel_3.setBounds(25, 216, 107, 14);

contentPane.add(lblNewLabel_3);

JLabel lblNewLabel_4 = new JLabel("Amount Paid (Rs) : ");

lblNewLabel_4.setBounds(25, 261, 107, 14);

contentPane.add(lblNewLabel_4);

JLabel lblNewLabel_5 = new JLabel("Pending Amount (Rs) : ");

lblNewLabel_5.setBounds(25, 302, 150, 14);

contentPane.add(lblNewLabel_5);

txt_Status = new JTextField();

txt_Status.setBounds(248, 171, 140, 20);

contentPane.add(txt_Status);

txt_Status.setColumns(10);

txt_Date = new JTextField();

txt_Date.setBounds(248, 216, 140, 20);

contentPane.add(txt_Date);

txt_Date.setColumns(10);

txt_Time = new JTextField();

79
txt_Time.setBounds(248, 258, 140, 20);

contentPane.add(txt_Time);

txt_Time.setColumns(10);

txt_Payment = new JTextField();

txt_Payment.setBounds(248, 299, 140, 20);

contentPane.add(txt_Payment);

txt_Payment.setColumns(10);

JButton btnUpdate = new JButton("Update");

btnUpdate.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent ae) {

try{

conn c = new conn();

int amt;

String s1 = c1.getSelectedItem();

String s2 = txt_ID.getText(); //room_number;

String s3 = txt_Status.getText(); //name

String s4 = txt_Date.getText(); //status;

String s5 = txt_Time.getText(); //deposit

c.s.executeUpdate("update customer set room_number = '"+s2+"', name = '"+s3+"',


status = '"+s4+"', deposit = '"+s5+"' where number = '"+s1+"'");

JOptionPane.showMessageDialog(null, "Data Updated Successfully");

new Reception().setVisible(true);

setVisible(false);

}catch(Exception ee){

80
System.out.println(ee);

});

btnUpdate.setBounds(168, 378, 89, 23);

btnUpdate.setBackground(Color.BLACK);

btnUpdate.setForeground(Color.WHITE);

contentPane.add(btnUpdate);

JButton btnExit = new JButton("Back");

btnExit.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

new Reception().setVisible(true);

setVisible(false);

});

btnExit.setBounds(281, 378, 89, 23);

btnExit.setBackground(Color.BLACK);

btnExit.setForeground(Color.WHITE);

contentPane.add(btnExit);

JButton btnAdd = new JButton("Check");

btnAdd.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

try{

String s1 = c1.getSelectedItem();

conn c = new conn();

81
ResultSet rs1 = c.s.executeQuery("select * from customer where number = "+s1);

while(rs1.next()){

txt_ID.setText(rs1.getString("room_number"));

txt_Status.setText(rs1.getString("name"));

txt_Date.setText(rs1.getString("status"));

txt_Time.setText(rs1.getString("deposit"));

}catch(Exception ee){}

try{

String total = "";

conn c = new conn();

ResultSet rs2 = c.s.executeQuery("select * from room where room_number =


"+txt_ID.getText());

while(rs2.next()){

total = rs2.getString("price");

String paid = txt_Time.getText();

int pending = Integer.parseInt(total)- Integer.parseInt(paid);

txt_Payment.setText(Integer.toString(pending));

}catch(Exception ee){}

});

btnAdd.setBounds(56, 378, 89, 23);

btnAdd.setBackground(Color.BLACK);

btnAdd.setForeground(Color.WHITE);

82
contentPane.add(btnAdd);

getContentPane().setBackground(Color.WHITE);

83
Update Room Status
package hotel.management.system;

import java.awt.BorderLayout;

import java.awt.*;

import java.sql.*;

import javax.swing.*;

import javax.swing.JFrame;

import javax.swing.JPanel;

import javax.swing.border.EmptyBorder;

import java.awt.Font;

import java.awt.event.ActionListener;

import java.awt.event.ActionEvent;

public class UpdateRoom extends JFrame {

Connection conn = null;

PreparedStatement pst = null;

private JPanel contentPane;

private JTextField txt_ID;

private JTextField txt_Ava;

private JTextField txt_Status;

private JTextField txt_Room;

Choice c1;

/**

* Launch the application.

*/

public static void main(String[] args) {

84
EventQueue.invokeLater(new Runnable() {

public void run() {

try {

UpdateRoom frame = new UpdateRoom();

frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

});

public void close(){

this.dispose();

/**

* Create the frame.

* @throws SQLException

*/

public UpdateRoom() throws SQLException {

//conn = Javaconnect.getDBConnection();

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setBounds(530, 200, 1000, 450);

contentPane = new JPanel();

contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

setContentPane(contentPane);

85
contentPane.setLayout(null);

ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/seventh.jpg"));

Image i3 = i1.getImage().getScaledInstance(550, 250,Image.SCALE_DEFAULT);

ImageIcon i2 = new ImageIcon(i3);

JLabel l1 = new JLabel(i2);

l1.setBounds(400,80,600,250);

add(l1);

JLabel lblUpdateRoomStatus = new JLabel("Update Room Status");

lblUpdateRoomStatus.setFont(new Font("Tahoma", Font.PLAIN, 20));

lblUpdateRoomStatus.setBounds(85, 11, 206, 34);

contentPane.add(lblUpdateRoomStatus);

JLabel lblNewLabel = new JLabel("Guest ID:");

lblNewLabel.setBounds(27, 87, 90, 14);

contentPane.add(lblNewLabel);

c1 = new Choice();

try{

conn c = new conn();

ResultSet rs = c.s.executeQuery("select * from customer");

while(rs.next()){

c1.add(rs.getString("number"));

}catch(Exception e){ }

c1.setBounds(160, 84, 140, 20);

contentPane.add(c1);

86
JLabel lblAvailability = new JLabel("Availability:");

lblAvailability.setBounds(27, 187, 90, 14);

contentPane.add(lblAvailability);

JLabel lblCleanStatus = new JLabel("Clean Status:");

lblCleanStatus.setBounds(27, 240, 90, 14);

contentPane.add(lblCleanStatus);

txt_Ava = new JTextField();

txt_Ava.setBounds(160, 184, 140, 20);

contentPane.add(txt_Ava);

txt_Ava.setColumns(10);

txt_Status = new JTextField();

txt_Status.setBounds(160, 237, 140, 20);

contentPane.add(txt_Status);

txt_Status.setColumns(10);

txt_Room = new JTextField();

txt_Room.setBounds(160, 130, 140, 20);

contentPane.add(txt_Room);

txt_Room.setColumns(10);

JButton b1 = new JButton("Check");

b1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

try{

String s1 = c1.getSelectedItem();

conn c = new conn();

ResultSet rs1 = c.s.executeQuery("select * from customer where number = "+s1);

87
while(rs1.next()){

txt_Room.setText(rs1.getString("room_number"));

}catch(Exception ee){}

try{

conn c = new conn();

ResultSet rs2 = c.s.executeQuery("select * from room where room_number =


"+txt_Room.getText());

while(rs2.next()){

txt_Ava.setText(rs2.getString("availability"));

txt_Status.setText(rs2.getString("clean_status"));

}catch(Exception ee){}

});

b1.setBounds(120, 315, 89, 23);

b1.setBackground(Color.BLACK);

b1.setForeground(Color.WHITE);

contentPane.add(b1);

JButton btnUpdate = new JButton("Update");

btnUpdate.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) throws NumberFormatException {

try{

conn c = new conn();

String str = "update room set clean_status = '"+txt_Status.getText()+"' where


room_number = "+txt_Room.getText();

88
c.s.executeUpdate(str);

JOptionPane.showMessageDialog(null, "Update Sucessful");

new Reception().setVisible(true);

setVisible(false);

}catch (Exception ee){

ee.printStackTrace();

});

btnUpdate.setBounds(60, 355, 89, 23);

btnUpdate.setBackground(Color.BLACK);

btnUpdate.setForeground(Color.WHITE);

contentPane.add(btnUpdate);

JButton btnExit = new JButton("Back");

btnExit.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

new Reception().setVisible(true);

setVisible(false);

});

btnExit.setBounds(180, 355, 89, 23);

btnExit.setBackground(Color.BLACK);

btnExit.setForeground(Color.WHITE);

contentPane.add(btnExit);

JLabel lblRoomId = new JLabel("Room Number:");

89
lblRoomId.setBounds(27, 133, 100, 14);

contentPane.add(lblRoomId);

getContentPane().setBackground(Color.WHITE);

90
Pick Up Service
package hotel.management.system;

import java.awt.BorderLayout;

import java.awt.*;

import java.sql.*;

import javax.swing.*;

import javax.swing.border.EmptyBorder;

import net.proteanit.sql.DbUtils;

import java.awt.Font;

import java.awt.event.ActionListener;

import java.awt.event.ActionEvent;

public class PickUp extends JFrame {

Connection conn = null;

PreparedStatement pst = null;

ResultSet rs = null;

private JPanel contentPane;

private JTable table;

Choice c1;

/**

* Launch the application.

*/

public static void main(String[] args) {

EventQueue.invokeLater(new Runnable() {

public void run() {

try {

91
PickUp frame = new PickUp();

frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

});

public void close()

this.dispose();

/**

* Create the frame.

* @throws SQLException

*/

public PickUp() throws SQLException {

//conn = Javaconnect.getDBConnection();

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setBounds(530, 200, 800, 600);

contentPane = new JPanel();

contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

setContentPane(contentPane);

contentPane.setLayout(null);

JLabel lblPickUpService = new JLabel("Pick Up Service");

92
lblPickUpService.setFont(new Font("Tahoma", Font.PLAIN, 20));

lblPickUpService.setBounds(90, 11, 158, 25);

contentPane.add(lblPickUpService);

JLabel lblTypeOfCar = new JLabel("Type of Car");

lblTypeOfCar.setBounds(32, 97, 89, 14);

contentPane.add(lblTypeOfCar);

c1 = new Choice();

try{

conn c = new conn();

ResultSet rs = c.s.executeQuery("select * from driver");

while(rs.next()){

c1.add(rs.getString("brand"));

}catch(Exception e){ }

c1.setBounds(123, 94, 150, 25);

contentPane.add(c1);

JLabel lblInfo = new JLabel("Name");

lblInfo.setBounds(24, 208, 46, 14);

contentPane.add(lblInfo);

JButton btnRegister = new JButton("Display");

btnRegister.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent arg0) {

String SQL = "select * from driver where brand =


'"+c1.getSelectedItem()+"'";

try{

93
conn c = new conn();

rs = c.s.executeQuery(SQL);

table.setModel(DbUtils.resultSetToTableModel(rs));

}catch (SQLException ss)

ss.printStackTrace();

});

btnRegister.setBounds(200, 500, 120, 30);

btnRegister.setBackground(Color.BLACK);

btnRegister.setForeground(Color.WHITE);

contentPane.add(btnRegister);

JButton btnExit = new JButton("Back");

btnExit.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent arg0) {

new Reception().setVisible(true);

setVisible(false);

});

btnExit.setBounds(420, 500, 120, 30);

btnExit.setBackground(Color.BLACK);

btnExit.setForeground(Color.WHITE);

contentPane.add(btnExit);

table = new JTable();

94
table.setBounds(0, 233, 800, 250);

contentPane.add(table);

JLabel lblNewLabel = new JLabel("Age");

lblNewLabel.setBounds(165, 208, 46, 14);

contentPane.add(lblNewLabel);

JLabel lblGender = new JLabel("Gender");

lblGender.setBounds(264, 208, 46, 14);

contentPane.add(lblGender);

JLabel lblTypeOfDriver = new JLabel("Company");

lblTypeOfDriver.setBounds(366, 208, 80, 14);

contentPane.add(lblTypeOfDriver);

JLabel lblDateOfThe = new JLabel("Brand");

lblDateOfThe.setBounds(486, 208, 105, 14);

contentPane.add(lblDateOfThe);

JLabel lblAirport = new JLabel("Available");

lblAirport.setBounds(600, 208, 86, 14);

contentPane.add(lblAirport);

JLabel lblAvailable = new JLabel("Location");

lblAvailable.setBounds(700, 208, 73, 14);

contentPane.add(lblAvailable);

getContentPane().setBackground(Color.WHITE);

95
96
Search Room
package hotel.management.system;

import java.awt.BorderLayout;

import java.awt.*;

import java.sql.*;

import javax.swing.*;

import javax.swing.JFrame;

import javax.swing.JPanel;

import javax.swing.border.EmptyBorder;

import net.proteanit.sql.DbUtils;

import java.awt.Font;

import java.awt.event.ActionListener;

import java.awt.event.ActionEvent;

public class SearchRoom extends JFrame {

Connection conn = null;

PreparedStatement pst = null;

ResultSet rs = null;

private JPanel contentPane;

private JTextField txt_Type;

private JTable table;

Choice c1;

/**

* Launch the application.

*/

public static void main(String[] args) {

97
EventQueue.invokeLater(new Runnable() {

public void run() {

try {

SearchRoom frame = new SearchRoom();

frame.setVisible(true);

} catch (Exception e) {

e.printStackTrace();

});

public void close()

this.dispose();

/**

* Create the frame.

* @throws SQLException

*/

public SearchRoom() throws SQLException {

//conn = Javaconnect.getDBConnection();

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

setBounds(530, 200, 700, 500);

contentPane = new JPanel();

contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

98
setContentPane(contentPane);

contentPane.setLayout(null);

JLabel lblSearchForRoom = new JLabel("Search For Room");

lblSearchForRoom.setFont(new Font("Tahoma", Font.PLAIN, 20));

lblSearchForRoom.setBounds(250, 11, 186, 31);

contentPane.add(lblSearchForRoom);

JLabel lblRoomAvailable = new JLabel("Room Bed Type:");

lblRoomAvailable.setBounds(50, 73, 96, 14);

contentPane.add(lblRoomAvailable);

JLabel lblRoomType = new JLabel("Room Number");

lblRoomType.setBounds(23, 162, 96, 14);

contentPane.add(lblRoomType);

JLabel lblRoomAvailable_1 = new JLabel("Availability");

lblRoomAvailable_1.setBounds(175, 162, 120, 14);

contentPane.add(lblRoomAvailable_1);

JLabel lblPrice_1 = new JLabel("Price");

lblPrice_1.setBounds(458, 162, 46, 14);

contentPane.add(lblPrice_1);

JLabel l1 = new JLabel("Bed Type");

l1.setBounds(580, 162, 96, 14);

contentPane.add(l1);

JCheckBox checkRoom = new JCheckBox("Only display Available");

checkRoom.setBounds(400, 69, 205, 23);

checkRoom.setBackground(Color.WHITE);

contentPane.add(checkRoom);

99
c1 = new Choice();

c1.add("Single Bed");

c1.add("Double Bed");

c1.setBounds(153, 70, 120, 20);

contentPane.add(c1);

JButton btnSearch = new JButton("Search");

btnSearch.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

String SQL = "select * from Room where bed_type =


'"+c1.getSelectedItem()+"'";

String SQL2 = "select * from Room where availability = 'Available'


AND bed_type = '"+c1.getSelectedItem()+"'";

try{

conn c = new conn();

rs = c.s.executeQuery(SQL);

table.setModel(DbUtils.resultSetToTableModel(rs));

if(checkRoom.isSelected())

rs = c.s.executeQuery(SQL2);

table.setModel(DbUtils.resultSetToTableModel(rs));

}catch (SQLException ss)

ss.printStackTrace();

100
});

btnSearch.setBounds(200, 400, 120, 30);

btnSearch.setBackground(Color.BLACK);

btnSearch.setForeground(Color.WHITE);

contentPane.add(btnSearch);

JButton btnExit = new JButton("Back");

btnExit.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {

new Reception().setVisible(true);

setVisible(false);

});

btnExit.setBounds(380, 400, 120, 30);

btnExit.setBackground(Color.BLACK);

btnExit.setForeground(Color.WHITE);

contentPane.add(btnExit);

table = new JTable();

table.setBounds(0, 187, 700, 300);

contentPane.add(table);

JLabel lblCleanStatus = new JLabel("Clean Status");

lblCleanStatus.setBounds(306, 162, 96, 14);

contentPane.add(lblCleanStatus);

getContentPane().setBackground(Color.WHITE);

101
102
Add Employee
package hotel.management.system;

import java.awt.EventQueue;

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

import javax.swing.*;

public class AddEmployee extends JFrame{ //Third Frame

JTextField textField,textField_1,textField_2,textField_3,textField_4,textField_5,textField_6;

JComboBox c1;

public AddEmployee(){

getContentPane().setForeground(Color.BLUE);

getContentPane().setBackground(Color.WHITE);

setTitle("ADD EMPLOYEE DETAILS");

setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);

setSize(778,486);

getContentPane().setLayout(null);

JLabel Passportno = new JLabel("NAME");

Passportno.setFont(new Font("Tahoma", Font.PLAIN, 17));

Passportno.setBounds(60, 30, 150, 27);

add(Passportno);

textField = new JTextField();

textField.setBounds(200, 30, 150, 27);

add(textField);

JButton Next = new JButton("SAVE");

103
Next.setBounds(200, 420, 150, 30);

Next.setBackground(Color.BLACK);

Next.setForeground(Color.WHITE);

add(Next);

JLabel Pnrno = new JLabel("AGE");

Pnrno.setFont(new Font("Tahoma", Font.PLAIN, 17));

Pnrno.setBounds(60, 80, 150, 27);

add(Pnrno);

textField_1 = new JTextField();

textField_1.setBounds(200, 80, 150, 27);

add(textField_1);

JLabel Gender = new JLabel("GENDER");

Gender.setFont(new Font("Tahoma", Font.PLAIN, 17));

Gender.setBounds(60, 120, 150, 27);

add(Gender);

JRadioButton NewRadioButton = new JRadioButton("MALE");

NewRadioButton.setBackground(Color.WHITE);

NewRadioButton.setBounds(200, 120, 70, 27);

add(NewRadioButton);

JRadioButton Female = new JRadioButton("FEMALE");

Female.setBackground(Color.WHITE);

Female.setBounds(280, 120, 70, 27);

add(Female);

JLabel Address = new JLabel("JOB");

Address.setFont(new Font("Tahoma", Font.PLAIN, 17));

104
Address.setBounds(60, 170, 150, 27);

add(Address);

String course[] = {"Front Desk Clerks","Porters","Housekeeping","Kitchen Staff","Room


Service","Waiter/Waitress","Manager","Accountant","Chef"};

c1 = new JComboBox(course);

c1.setBackground(Color.WHITE);

c1.setBounds(200,170,150,30);

add(c1);

JLabel Nationality = new JLabel("SALARY");

Nationality.setFont(new Font("Tahoma", Font.PLAIN, 17));

Nationality.setBounds(60, 220, 150, 27);

add(Nationality);

textField_3 = new JTextField();

textField_3.setBounds(200, 220, 150, 27);

add(textField_3);

JLabel Name = new JLabel("PHONE");

Name.setFont(new Font("Tahoma", Font.PLAIN, 17));

Name.setBounds(60, 270, 150, 27);

add(Name);

textField_4 = new JTextField();

textField_4.setBounds(200, 270, 150, 27);

add(textField_4);

JLabel Phno = new JLabel("AADHAR");

Phno.setFont(new Font("Tahoma", Font.PLAIN, 17));

Phno.setBounds(60, 320, 150, 27);

105
add(Phno);

textField_5 = new JTextField();

textField_5.setBounds(200, 320, 150, 27);

add(textField_5);

JLabel email = new JLabel("EMAIL");

email.setFont(new Font("Tahoma", Font.PLAIN, 17));

email.setBounds(60, 370, 150, 27);

add(email);

textField_6 = new JTextField();

textField_6.setBounds(200, 370, 150, 27);

add(textField_6);

setVisible(true);

JLabel AddPassengers = new JLabel("ADD EMPLOYEE DETAILS");

AddPassengers.setForeground(Color.BLUE);

AddPassengers.setFont(new Font("Tahoma", Font.PLAIN, 31));

AddPassengers.setBounds(450, 24, 442, 35);

add(AddPassengers);

ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/tenth.jpg"));

Image i3 = i1.getImage().getScaledInstance(500, 500,Image.SCALE_DEFAULT);

ImageIcon i2 = new ImageIcon(i3);

JLabel image = new JLabel(i2);

image.setBounds(410,80,480,410);

add(image);

Next.addActionListener(new ActionListener(){

106
public void actionPerformed(ActionEvent ae){

String name = textField.getText();

String age = textField_1.getText();

String salary = textField_3.getText();

String phone = textField_4.getText();

String aadhar = textField_5.getText();

String email = textField_6.getText();

String gender = null;

if(NewRadioButton.isSelected()){

gender = "male";

}else if(Female.isSelected()){

gender = "female";

String s6 = (String)c1.getSelectedItem();

try {

conn c = new conn();

String str = "INSERT INTO employee values( '"+name+"', '"+age+"',


'"+gender+"','"+s6+"', '"+salary+"', '"+phone+"','"+aadhar+"', '"+email+"')";

c.s.executeUpdate(str);

JOptionPane.showMessageDialog(null,"Employee Added");

setVisible(false);

} catch (Exception e) {

e.printStackTrace();

107
});

setSize(900,600);

setVisible(true);

setLocation(530,200);

public static void main(String[] args){

new AddEmployee();

108
Add Rooms
package hotel.management.system;

import java.awt.*;

import javax.swing.*;

import javax.swing.border.*;

import java.awt.event.*;

import java.sql.*;

import java.util.*;

public class AddRoom extends JFrame implements ActionListener{

private JPanel contentPane;

private JTextField t1,t2,t3,t4;

private JComboBox comboBox, comboBox_1, comboBox_2, comboBox_3;

JButton b1,b2;

Choice c1;

public static void main(String[] args) {

new AddRoom().setVisible(true);

public AddRoom() {

setBounds(450, 200, 1000, 450);

contentPane = new JPanel();

setContentPane(contentPane);

contentPane.setLayout(null);

ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/twelve.jpg"));

Image i3 = i1.getImage().getScaledInstance(500, 300,Image.SCALE_DEFAULT);

109
ImageIcon i2 = new ImageIcon(i3);

JLabel l15 = new JLabel(i2);

l15.setBounds(400,30,500,370);

add(l15);

JLabel l10 = new JLabel("Add Rooms");

l10.setFont(new Font("Tahoma", Font.BOLD, 18));

l10.setBounds(194, 10, 120, 22);

contentPane.add(l10);

JLabel l1 = new JLabel("Room Number");

l1.setForeground(new Color(25, 25, 112));

l1.setFont(new Font("Tahoma", Font.BOLD, 14));

l1.setBounds(64, 70, 102, 22);

contentPane.add(l1);

t4 = new JTextField();

t4.setBounds(174, 70, 156, 20);

contentPane.add(t4);

JLabel l2 = new JLabel("Availability");

l2.setForeground(new Color(25, 25, 112));

l2.setFont(new Font("Tahoma", Font.BOLD, 14));

l2.setBounds(64, 110, 102, 22);

contentPane.add(l2);

comboBox = new JComboBox(new String[] { "Available", "Occupied" });

comboBox.setBounds(176, 110, 154, 20);

contentPane.add(comboBox);

JLabel l3 = new JLabel("Cleaning Status");

110
l3.setForeground(new Color(25, 25, 112));

l3.setFont(new Font("Tahoma", Font.BOLD, 14));

l3.setBounds(64, 150, 102, 22);

contentPane.add(l3);

comboBox_2 = new JComboBox(new String[] { "Cleaned", "Dirty" });

comboBox_2.setBounds(176, 150, 154, 20);

contentPane.add(comboBox_2);

JLabel l4 = new JLabel("Price");

l4.setForeground(new Color(25, 25, 112));

l4.setFont(new Font("Tahoma", Font.BOLD, 14));

l4.setBounds(64, 190, 102, 22);

contentPane.add(l4);

t2 = new JTextField();

t2.setBounds(174, 190, 156, 20);

contentPane.add(t2);

JLabel l5 = new JLabel("Bed Type");

l5.setForeground(new Color(25, 25, 112));

l5.setFont(new Font("Tahoma", Font.BOLD, 14));

l5.setBounds(64, 230, 102, 22);

contentPane.add(l5);

comboBox_3 = new JComboBox(new String[] { "Single Bed", "Double Bed"});

comboBox_3.setBounds(176, 230, 154, 20);

contentPane.add(comboBox_3);

b1 = new JButton("Add");

b1.addActionListener(this);

111
b1.setBounds(64, 321, 111, 33);

b1.setBackground(Color.BLACK);

b1.setForeground(Color.WHITE);

contentPane.add(b1);

b2 = new JButton("Back");

b2.addActionListener(this);

b2.setBounds(198, 321, 111, 33);

b2.setBackground(Color.BLACK);

b2.setForeground(Color.WHITE);

contentPane.add(b2);

contentPane.setBackground(Color.WHITE);

public void actionPerformed(ActionEvent ae){

try{

if(ae.getSource() == b1){

try{

conn c = new conn();

String room = t4.getText();

String available = (String)comboBox.getSelectedItem();

String status = (String)comboBox_2.getSelectedItem();

String price = t2.getText();

String type = (String)comboBox_3.getSelectedItem();

String str = "INSERT INTO room values( '"+room+"', '"+available+"', '"+status+"','"+price+"',


'"+type+"')";

c.s.executeUpdate(str);

112
JOptionPane.showMessageDialog(null, "Room Successfully Added");

this.setVisible(false);

}catch(Exception ee){

System.out.println(ee);

else if(ae.getSource() == b2){

this.setVisible(false);

}catch(Exception eee){

113
Add Drivers
package hotel.management.system;

import java.awt.*;

import javax.swing.*;

import javax.swing.border.*;

import java.awt.event.*;

import java.sql.*;

import java.util.*;

public class AddDrivers extends JFrame implements ActionListener{

private JPanel contentPane;

private JTextField t1,t2,t3,t4, t5;

private JComboBox comboBox, comboBox_1;

JButton b1,b2;

Choice c1;

public static void main(String[] args) {

new AddDrivers().setVisible(true);

public AddDrivers() {

setBounds(450, 200, 1000, 500);

contentPane = new JPanel();

setContentPane(contentPane);

contentPane.setLayout(null);

ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/eleven.jpg"));

Image i3 = i1.getImage().getScaledInstance(500, 300,Image.SCALE_DEFAULT);

114
ImageIcon i2 = new ImageIcon(i3);

JLabel l15 = new JLabel(i2);

l15.setBounds(400,30,500,370);

add(l15);

JLabel l10 = new JLabel("Add Drivers");

l10.setFont(new Font("Tahoma", Font.BOLD, 18));

l10.setBounds(194, 10, 120, 22);

contentPane.add(l10);

JLabel l1 = new JLabel("Name");

l1.setForeground(new Color(25, 25, 112));

l1.setFont(new Font("Tahoma", Font.BOLD, 14));

l1.setBounds(64, 70, 102, 22);

contentPane.add(l1);

t1 = new JTextField();

t1.setBounds(174, 70, 156, 20);

contentPane.add(t1);

JLabel l2 = new JLabel("Age");

l2.setForeground(new Color(25, 25, 112));

l2.setFont(new Font("Tahoma", Font.BOLD, 14));

l2.setBounds(64, 110, 102, 22);

contentPane.add(l2);

t2 = new JTextField();

t2.setBounds(174, 110, 156, 20);

contentPane.add(t2);

JLabel l3 = new JLabel("Gender");

115
l3.setForeground(new Color(25, 25, 112));

l3.setFont(new Font("Tahoma", Font.BOLD, 14));

l3.setBounds(64, 150, 102, 22);

contentPane.add(l3);

comboBox = new JComboBox(new String[] { "Male", "Female" });

comboBox.setBounds(176, 150, 154, 20);

contentPane.add(comboBox);

JLabel l4 = new JLabel("Car Company");

l4.setForeground(new Color(25, 25, 112));

l4.setFont(new Font("Tahoma", Font.BOLD, 14));

l4.setBounds(64, 190, 102, 22);

contentPane.add(l4);

t3 = new JTextField();

t3.setBounds(174, 190, 156, 20);

contentPane.add(t3);

JLabel l5 = new JLabel("Car Brand");

l5.setForeground(new Color(25, 25, 112));

l5.setFont(new Font("Tahoma", Font.BOLD, 14));

l5.setBounds(64, 230, 102, 22);

contentPane.add(l5);

t4 = new JTextField();

t4.setBounds(174, 230, 156, 20);

contentPane.add(t4);

JLabel l6 = new JLabel("Available");

l6.setForeground(new Color(25, 25, 112));

116
l6.setFont(new Font("Tahoma", Font.BOLD, 14));

l6.setBounds(64, 270, 102, 22);

contentPane.add(l6);

comboBox_1 = new JComboBox(new String[] { "Yes", "No" });

comboBox_1.setBounds(176, 270, 154, 20);

contentPane.add(comboBox_1);

JLabel l7 = new JLabel("Location");

l7.setForeground(new Color(25, 25, 112));

l7.setFont(new Font("Tahoma", Font.BOLD, 14));

l7.setBounds(64, 310, 102, 22);

contentPane.add(l7);

t5 = new JTextField();

t5.setBounds(174, 310, 156, 20);

contentPane.add(t5);

b1 = new JButton("Add");

b1.addActionListener(this);

b1.setBounds(64, 380, 111, 33);

b1.setBackground(Color.BLACK);

b1.setForeground(Color.WHITE);

contentPane.add(b1);

b2 = new JButton("Back");

b2.addActionListener(this);

b2.setBounds(198, 380, 111, 33);

b2.setBackground(Color.BLACK);

b2.setForeground(Color.WHITE);

117
contentPane.add(b2);

contentPane.setBackground(Color.WHITE);

public void actionPerformed(ActionEvent ae){

try{

if(ae.getSource() == b1){

try{

conn c = new conn();

String name = t1.getText();

String age = t2.getText();

String gender = (String)comboBox.getSelectedItem();

String company = t3.getText();

String brand = t4.getText();

String available = (String)comboBox_1.getSelectedItem();

String location = t5.getText();

String str = "INSERT INTO driver values( '"+name+"', '"+age+"', '"+gender+"','"+company+"',


'"+brand+"', '"+available+"','"+location+"')";

c.s.executeUpdate(str);

JOptionPane.showMessageDialog(null, "Driver Successfully Added");

this.setVisible(false);

}catch(Exception ee){

System.out.println(ee);

else if(ae.getSource() == b2){

118
this.setVisible(false);

}catch(Exception eee){

119
DATABASE
create database hms;

use hms;

Login Database

create table login(

username varchar(40),

password varchar(40)

);

insert into login values('admin','12345');

Customer Database
create table customer(

id varchar(30),

number varchar(30),

name varchar(30),

gender varchar(30),

country varchar(30),

room_number varchar(30),

status varchar(30),

deposit varchar(30)

);

Room Database
create table room(

room_number varchar(20),

availability varchar(20),

clean_status varchar(20),

120
price varchar(20),

bed_type varchar(30)

);

Employee Database

create table employee(

name varchar(30),

age varchar(10),

gender varchar(30),

job varchar(30),

salary varchar(30),

phone varchar(30),

aadhar varchar(30),

email varchar(40)

);

Driver Database

create table driver(

name varchar(30),

age varchar(10),

gender varchar(20),

company varchar(30),

brand varchar(30),

available varchar(10),

location varchar(50)

);

121
Department Database
create table department(
department varchar(30),
budget varchar(30)
);

122
123
Testing

Unit Testing

Unit testing is a testing technique in which modules are tested individually. Small individual units of
source code are tested to determine whether it is fit to use or not. Different modules of games are
put to test while the modules are being developed. Here modules refer to individual levels,
players, scenes

Integration Testing

Integration testing is the technique in which individual components or modules are grouped
together and tested. It occurs after testing. The input for the integrated testing, are the modules
that have already been unit tested.

System Testing

System testing is conducted on the entire system as a whole to check whether the system meets its
requirements or not. ‘Valar Morghulis’ was installed on different systems and any errors or bugs that
occurred were fixed.

Acceptance Testing

User Acceptance is defined as a type of testing performed by the Client to certify the system with
respect to the requirements that was agreed upon. This testing happens in the final phase of testing
before moving the software application to the Market or Production environment.

124
FUTURE SCOPE

The world is changing rapidly and so is the meaning of the Hotel Management System. Today hotel
management is not only confined to hotels but has gone deep into tourism, catering, clubs, etc making it a
very paying and an exciting career option.

With the rapid growth of the hotel industry pushed forward by foreign and domestic tourism and business
travels, the demand for well trained and quality personnel too has gone up high. India is one of the
preferred tourist and travel destinations. Approx 4.4 million tourists visit our country every year. The
growth of 20% has been recorded in the tourist and hospitality industry over a few years and more growth
is expected in coming years. At present, there are about 200 millions of jobs available in the industry, out
of which 20% of the job opportunities are in India.

The Hotel Management System has a lot of enhancement options. In future more features may be added
category-wise. It may try to analyze the user behaviour and preferences and accordingly suggest. All
concepts can be applied to make the Hotel Management System more efficient.

125
Conclusion

In this project I have tried my best to make user friendly software. This
software can be handled by any person who has little bit of idea of
computers. In this software I have tried to meet most of the requirements
of the present hotel management system including maintaining details of
customers, rooms, employees and drivers. I also keep provision to update
the details of customers, rooms and employees. In my effort I have tried
to make my software all the more user friendly but there may some
features which I would like to include in my continuous attempts.

126
REFERENCE

1. Java: The Complete Reference by Herbert Schildt this book provides a comprehensive
overview of Java, including Swing for GUI development.

2.Head First Java by Kathy Sierra and Bert Bates

This book is excellent for beginners and provides an interactive way to learn Java and GUI

java swing ui creation

Jar files for external inclusion

Mysql connector for database connection

Xampp server for database table view and store data

127

You might also like