Hotel Management Project
Hotel Management Project
Hotel Management Project
3
TABLE OF CONTENT
1. Introduction
Objective
Feature
2. Analysis
Feasibility Study
Requirement Specification
3. Design Phase
Class Diagram
ER Diagram
FLowchart
Sequence Diagram
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
6
ANALYSIS
Current System of Hotel Management is fully based on paperwork. Hotel Management has to manage all
records of customers and rooms on paper.
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.
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.
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.
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
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 Statement s;
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.*;
JLabel l1;
JButton b1;
public HotelManagementSystem() {
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"));
l1 = new JLabel(i2);
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.add(b1);
add(l1);
b1.addActionListener(this);
setVisible(true);
while(true){
try{
}catch(Exception e){}
lid.setVisible(true);
try{
Thread.sleep(500);
}catch(Exception e){}
new Login().setVisible(true);
this.setVisible(false);
window.setVisible(true);
18
}
19
Login
package hotel.management.system;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.sql.*;
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);
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);
if(ae.getSource()==b1){
try{
String u = t1.getText();
String v = t2.getText();
ResultSet rs = c1.s.executeQuery(q);
if(rs.next()){
new Dashboard().setVisible(true);
setVisible(false);
}else{
setVisible(false);
}catch(Exception e){
e.printStackTrace();
}else if(ae.getSource()==b2){
System.exit(0);
22
new Login();
23
Dashboard
package hotel.management.system;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
new Dashboard().setVisible(true);
public Dashboard() {
setForeground(Color.CYAN);
setLayout(null);
ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/third.jpg"));
add(NewLabel);
AirlineManagementSystem.setForeground(Color.WHITE);
NewLabel.add(AirlineManagementSystem);
24
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar);
AirlineSystem.setForeground(Color.BLUE);
menuBar.add(AirlineSystem);
AirlineSystem.add(FlightDetails);
AirlineSystemHello.setForeground(Color.RED);
menuBar.add(AirlineSystemHello);
AirlineSystemHello.add(FlightDetailshello1);
FlightDetailshello1.addActionListener(new ActionListener(){
try{
new AddEmployee().setVisible(true);
}catch(Exception e ){}
});
AirlineSystemHello.add(FlightDetailshello2);
FlightDetailshello2.addActionListener(new ActionListener(){
try{
new AddRoom().setVisible(true);
25
}catch(Exception e ){}
});
FlightDetails.addActionListener(new ActionListener(){
new Reception();
});
AirlineSystemHello.add(FlightDetailshello3);
FlightDetailshello3.addActionListener(new ActionListener(){
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.*;
new Reception();
public Reception(){
setContentPane(contentPane);
contentPane.setLayout(null);
ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/fourth.jpg"));
l1.setBounds(250,30,500,470);
add(l1);
btnNewCustomerForm.addActionListener(new ActionListener() {
28
public void actionPerformed(ActionEvent e) {
try{
custom.setVisible(true);
setVisible(false);
}catch(Exception e1){
e1.printStackTrace();
});
btnNewCustomerForm.setBackground(Color.BLACK);
btnNewCustomerForm.setForeground(Color.WHITE);
contentPane.add(btnNewCustomerForm);
btnNewButton.addActionListener(new ActionListener() {
try{
room.setVisible(true);
setVisible(false);
catch(Exception e){
e.printStackTrace();
29
}
});
btnNewButton.setBackground(Color.BLACK);
btnNewButton.setForeground(Color.WHITE);
contentPane.add(btnNewButton);
btnNewButton_1.addActionListener(new ActionListener() {
try{
dept.setVisible(true);
setVisible(false);
e1.printStackTrace();
});
btnNewButton_1.setBackground(Color.BLACK);
btnNewButton_1.setForeground(Color.WHITE);
contentPane.add(btnNewButton_1);
btnNewButton_2.addActionListener(new ActionListener() {
30
public void actionPerformed(ActionEvent e) {
try{
em.setVisible(true);
setVisible(false);
e1.printStackTrace();
});
btnNewButton_2.setBackground(Color.BLACK);
btnNewButton_2.setForeground(Color.WHITE);
contentPane.add(btnNewButton_2);
btnNewButton_3.addActionListener(new ActionListener() {
try{
//error
customer.setVisible(true);
setVisible(false);
31
e1.printStackTrace();
});
btnNewButton_3.setBackground(Color.BLACK);
btnNewButton_3.setForeground(Color.WHITE);
contentPane.add(btnNewButton_3);
btnManagerInfo.addActionListener(new ActionListener() {
try{
mana.setVisible(true);
setVisible(false);
e1.printStackTrace();
});
btnManagerInfo.setBackground(Color.BLACK);
btnManagerInfo.setForeground(Color.WHITE);
contentPane.add(btnManagerInfo);
32
JButton btnNewButton_4 = new JButton("Check Out");
btnNewButton_4.addActionListener(new ActionListener() {
CheckOut check;
try {
check.setVisible(true);
setVisible(false);
e1.printStackTrace();
});
btnNewButton_4.setBackground(Color.BLACK);
btnNewButton_4.setForeground(Color.WHITE);
contentPane.add(btnNewButton_4);
btnNewButton_5.addActionListener(new ActionListener() {
try{
update.setVisible(true);
setVisible(false);
33
}
catch(Exception e1){
e1.printStackTrace();
});
btnNewButton_5.setBackground(Color.BLACK);
btnNewButton_5.setForeground(Color.WHITE);
contentPane.add(btnNewButton_5);
btnNewButton_6.addActionListener(new ActionListener() {
try{
room.setVisible(true);
setVisible(false);
}catch(Exception s)
s.printStackTrace();
});
btnNewButton_6.setBackground(Color.BLACK);
34
btnNewButton_6.setForeground(Color.WHITE);
contentPane.add(btnNewButton_6);
btnPickUpSerice.addActionListener(new ActionListener() {
try{
pick.setVisible(true);
setVisible(false);
catch(Exception e){
e.printStackTrace();
});
btnPickUpSerice.setBackground(Color.BLACK);
btnPickUpSerice.setForeground(Color.WHITE);
contentPane.add(btnPickUpSerice);
btnSearchRoom.addActionListener(new ActionListener() {
try {
search.setVisible(true);
35
setVisible(false);
ss.printStackTrace();
});
btnSearchRoom.setBackground(Color.BLACK);
btnSearchRoom.setForeground(Color.WHITE);
contentPane.add(btnSearchRoom);
btnNewButton_7.addActionListener(new ActionListener() {
try {
new Login().setVisible(true);
setVisible(false);
} catch (Exception e) {
e.printStackTrace();
});
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;
JComboBox comboBox;
JRadioButton r1,r2;
Choice c1;
/**
*/
EventQueue.invokeLater(new Runnable() {
38
public void run() {
try {
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
});
setContentPane(contentPane);
contentPane.setLayout(null);
ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/fifth.png"));
l1.setBounds(480,10,300,500);
add(l1);
39
contentPane.add(lblName);
contentPane.add(lblId);
comboBox = new JComboBox(new String[] {"Passport", "Aadhar Card", "Voter Id", "Driving
license"});
contentPane.add(comboBox);
contentPane.add(l2);
t1 = new JTextField();
contentPane.add(t1);
t1.setColumns(10);
contentPane.add(lblName_1);
t2 = new JTextField();
contentPane.add(t2);
t2.setColumns(10);
contentPane.add(lblGender);
40
r1 = new JRadioButton("Male");
r1.setBackground(Color.WHITE);
add(r1);
r2 = new JRadioButton("Female");
r2.setBackground(Color.WHITE);
add(r2);
contentPane.add(lblCountry);
contentPane.add(lblReserveRoomNumber);
c1 = new Choice();
try{
while(rs.next()){
c1.add(rs.getString("room_number"));
}catch(Exception e){ }
41
contentPane.add(c1);
contentPane.add(lblCheckInStatus);
contentPane.add(lblDeposite);
t3 = new JTextField();
contentPane.add(t3);
t3.setColumns(10);
t5 = new JTextField();
contentPane.add(t5);
t5.setColumns(10);
t6 = new JTextField();
contentPane.add(t6);
t6.setColumns(10);
btnNewButton.addActionListener(new ActionListener() {
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();
c.s.executeUpdate(q1);
c.s.executeUpdate(q2);
new Reception().setVisible(true);
setVisible(false);
}catch(SQLException e1){
System.out.println(e1.getMessage());
43
}
catch(NumberFormatException s){
});
btnNewButton.setBackground(Color.BLACK);
btnNewButton.setForeground(Color.WHITE);
contentPane.add(btnNewButton);
btnExit.addActionListener(new ActionListener() {
new Reception().setVisible(true);
setVisible(false);
});
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;
/**
46
*/
EventQueue.invokeLater(new Runnable() {
try {
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
});
//conn = Javaconnect.getDBConnection();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setContentPane(contentPane);
contentPane.setLayout(null);
ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/eight.jpg"));
47
JLabel l1 = new JLabel(i2);
l1.setBounds(500,0,600,600);
add(l1);
contentPane.add(table);
btnLoadData.addActionListener(new ActionListener() {
try{
//PreparedStatement pst =
conn.prepareStatement(displayCustomersql);
ResultSet rs = c.s.executeQuery(displayCustomersql);
table.setModel(DbUtils.resultSetToTableModel(rs));
catch(Exception e1){
e1.printStackTrace();
});
btnLoadData.setBackground(Color.BLACK);
48
btnLoadData.setForeground(Color.WHITE);
contentPane.add(btnLoadData);
btnNewButton.addActionListener(new ActionListener() {
new Reception().setVisible(true);
setVisible(false);
});
btnNewButton.setBackground(Color.BLACK);
btnNewButton.setForeground(Color.WHITE);
contentPane.add(btnNewButton);
contentPane.add(lblAvailability);
contentPane.add(lblCleanStatus);
contentPane.add(lblNewLabel);
contentPane.add(lblNewLabel_1);
49
lblId = new JLabel("Room Number");
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;
/**
*/
EventQueue.invokeLater(new Runnable() {
51
try {
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
});
this.dispose();
/**
* @throws SQLException
*/
//conn = Javaconnect.getDBConnection();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setContentPane(contentPane);
contentPane.setLayout(null);
52
table = new JTable();
contentPane.add(table);
btnNewButton.addActionListener(new ActionListener() {
try{
ResultSet rs = c.s.executeQuery(displayCustomersql);
table.setModel(DbUtils.resultSetToTableModel(rs));
e1.printStackTrace();
});
btnNewButton.setBackground(Color.BLACK);
btnNewButton.setForeground(Color.WHITE);
contentPane.add(btnNewButton);
btnNewButton_1.addActionListener(new ActionListener() {
new Reception().setVisible(true);
53
setVisible(false);
});
btnNewButton_1.setBackground(Color.BLACK);
btnNewButton_1.setForeground(Color.WHITE);
contentPane.add(btnNewButton_1);
contentPane.add(lblNewLabel);
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;
/**
*/
55
EventQueue.invokeLater(new Runnable() {
try {
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
});
this.dispose();
/**
* @throws SQLException
*/
//conn = Javaconnect.getDBConnection();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
56
setContentPane(contentPane);
contentPane.setLayout(null);
contentPane.add(table);
btnLoadData.addActionListener(new ActionListener() {
try{
ResultSet rs = c.s.executeQuery(displayCustomersql);
table.setModel(DbUtils.resultSetToTableModel(rs));
catch(Exception e1){
e1.printStackTrace();
});
btnLoadData.setBackground(Color.BLACK);
btnLoadData.setForeground(Color.WHITE);
contentPane.add(btnLoadData);
btnExit.addActionListener(new ActionListener() {
57
public void actionPerformed(ActionEvent e) {
new Reception().setVisible(true);
setVisible(false);
});
btnExit.setBackground(Color.BLACK);
btnExit.setForeground(Color.WHITE);
contentPane.add(btnExit);
contentPane.add(lblNewLabel);
contentPane.add(lblJob);
contentPane.add(lblName);
contentPane.add(lblDepartment);
contentPane.add(l1);
58
l2.setBounds(656, 11, 86, 14);
contentPane.add(l2);
contentPane.add(l3);
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;
60
/**
*/
EventQueue.invokeLater(new Runnable() {
try {
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
});
this.dispose();
/**
* @throws SQLException
*/
//conn = Javaconnect.getDBConnection();
61
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setContentPane(contentPane);
contentPane.setLayout(null);
btnExit.addActionListener(new ActionListener() {
new Reception().setVisible(true);
setVisible(false);
});
btnExit.setBackground(Color.BLACK);
btnExit.setForeground(Color.WHITE);
contentPane.add(btnExit);
btnLoadData.addActionListener(new ActionListener() {
try{
ResultSet rs = c.s.executeQuery(displayCustomersql);
table.setModel(DbUtils.resultSetToTableModel(rs));
62
}
catch(Exception e)
e.printStackTrace();
});
btnLoadData.setBackground(Color.BLACK);
btnLoadData.setForeground(Color.WHITE);
contentPane.add(btnLoadData);
contentPane.add(lblId);
contentPane.add(l1);
contentPane.add(lblNewLabel);
contentPane.add(lblGender);
63
contentPane.add(table);
contentPane.add(lblCountry);
contentPane.add(lblRoom);
contentPane.add(lblStatus);
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;
/**
*/
65
EventQueue.invokeLater(new Runnable() {
try {
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
});
this.dispose();
/**
* @throws SQLException
*/
//conn = Javaconnect.getDBConnection();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
66
setContentPane(contentPane);
contentPane.setLayout(null);
contentPane.add(table);
btnLoadData.addActionListener(new ActionListener() {
try{
ResultSet rs = c.s.executeQuery(displayCustomersql);
table.setModel(DbUtils.resultSetToTableModel(rs));
catch(Exception e1){
e1.printStackTrace();
});
btnLoadData.setBackground(Color.BLACK);
btnLoadData.setForeground(Color.WHITE);
contentPane.add(btnLoadData);
67
btnExit.addActionListener(new ActionListener() {
new Reception().setVisible(true);
setVisible(false);
});
btnExit.setBackground(Color.BLACK);
btnExit.setForeground(Color.WHITE);
contentPane.add(btnExit);
contentPane.add(lblNewLabel);
contentPane.add(lblJob);
contentPane.add(lblName);
contentPane.add(lblDepartment);
contentPane.add(l1);
68
JLabel l2 = new JLabel("Phone");
contentPane.add(l2);
contentPane.add(l3);
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;
Choice c1;
/**
*/
EventQueue.invokeLater(new Runnable() {
try {
70
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
});
this.dispose();
/**
* @throws SQLException
*/
//conn = Javaconnect.getDBConnection();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setContentPane(contentPane);
contentPane.setLayout(null);
ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/sixth.jpg"));
71
ImageIcon i2 = new ImageIcon(i3);
l1.setBounds(300,0,500,225);
add(l1);
contentPane.add(lblCheckOut);
contentPane.add(lblName);
c1 = new Choice();
try{
while(rs.next()){
c1.add(rs.getString("number"));
}catch(Exception e){ }
contentPane.add(c1);
ImageIcon i4 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/tick.png"));
72
JButton l2 = new JButton(i6);
l2.setBounds(290,82,20,20);
add(l2);
l2.addActionListener(new ActionListener(){
System.out.println("Hi");
try{
if(rs.next()){
System.out.println("clicked");
t1.setText(rs.getString("room_number"));
}catch(Exception e){ }
});
contentPane.add(lblRoomNumber);
t1 = new JTextField();
contentPane.add(t1);
btnCheckOut.addActionListener(new ActionListener() {
73
public void actionPerformed(ActionEvent e) {
String id = c1.getSelectedItem();
String s1 = t1.getText();
try{
c.s.executeUpdate(deleteSQL);
c.s.executeUpdate(q2);
new Reception().setVisible(true);
setVisible(false);
}catch(SQLException e1){
System.out.println(e1.getMessage());
});
btnCheckOut.setBackground(Color.BLACK);
btnCheckOut.setForeground(Color.WHITE);
contentPane.add(btnCheckOut);
btnExit.addActionListener(new ActionListener() {
new Reception().setVisible(true);
74
setVisible(false);
});
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;
/**
*/
76
EventQueue.invokeLater(new Runnable() {
try {
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
});
this.dispose();
/**
* @throws SQLException
*/
//conn = Javaconnect.getDBConnection();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setContentPane(contentPane);
77
contentPane.setLayout(null);
contentPane.add(lblUpdateCheckStatus);
ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/nine.jpg"));
l1.setBounds(450,70,476,270);
add(l1);
contentPane.add(lblNewLabel);
c1 = new Choice();
try{
while(rs.next()){
c1.add(rs.getString("number"));
}catch(Exception e){ }
contentPane.add(c1);
78
contentPane.add(lblNewLabel_1);
contentPane.add(txt_ID);
contentPane.add(lblNewLabel_2);
contentPane.add(lblNewLabel_3);
contentPane.add(lblNewLabel_4);
contentPane.add(lblNewLabel_5);
contentPane.add(txt_Status);
txt_Status.setColumns(10);
contentPane.add(txt_Date);
txt_Date.setColumns(10);
79
txt_Time.setBounds(248, 258, 140, 20);
contentPane.add(txt_Time);
txt_Time.setColumns(10);
contentPane.add(txt_Payment);
txt_Payment.setColumns(10);
btnUpdate.addActionListener(new ActionListener() {
try{
int amt;
String s1 = c1.getSelectedItem();
new Reception().setVisible(true);
setVisible(false);
}catch(Exception ee){
80
System.out.println(ee);
});
btnUpdate.setBackground(Color.BLACK);
btnUpdate.setForeground(Color.WHITE);
contentPane.add(btnUpdate);
btnExit.addActionListener(new ActionListener() {
new Reception().setVisible(true);
setVisible(false);
});
btnExit.setBackground(Color.BLACK);
btnExit.setForeground(Color.WHITE);
contentPane.add(btnExit);
btnAdd.addActionListener(new ActionListener() {
try{
String s1 = c1.getSelectedItem();
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{
while(rs2.next()){
total = rs2.getString("price");
txt_Payment.setText(Integer.toString(pending));
}catch(Exception ee){}
});
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;
Choice c1;
/**
*/
84
EventQueue.invokeLater(new Runnable() {
try {
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
});
this.dispose();
/**
* @throws SQLException
*/
//conn = Javaconnect.getDBConnection();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setContentPane(contentPane);
85
contentPane.setLayout(null);
ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/seventh.jpg"));
l1.setBounds(400,80,600,250);
add(l1);
contentPane.add(lblUpdateRoomStatus);
contentPane.add(lblNewLabel);
c1 = new Choice();
try{
while(rs.next()){
c1.add(rs.getString("number"));
}catch(Exception e){ }
contentPane.add(c1);
86
JLabel lblAvailability = new JLabel("Availability:");
contentPane.add(lblAvailability);
contentPane.add(lblCleanStatus);
contentPane.add(txt_Ava);
txt_Ava.setColumns(10);
contentPane.add(txt_Status);
txt_Status.setColumns(10);
contentPane.add(txt_Room);
txt_Room.setColumns(10);
b1.addActionListener(new ActionListener() {
try{
String s1 = c1.getSelectedItem();
87
while(rs1.next()){
txt_Room.setText(rs1.getString("room_number"));
}catch(Exception ee){}
try{
while(rs2.next()){
txt_Ava.setText(rs2.getString("availability"));
txt_Status.setText(rs2.getString("clean_status"));
}catch(Exception ee){}
});
b1.setBackground(Color.BLACK);
b1.setForeground(Color.WHITE);
contentPane.add(b1);
btnUpdate.addActionListener(new ActionListener() {
try{
88
c.s.executeUpdate(str);
new Reception().setVisible(true);
setVisible(false);
ee.printStackTrace();
});
btnUpdate.setBackground(Color.BLACK);
btnUpdate.setForeground(Color.WHITE);
contentPane.add(btnUpdate);
btnExit.addActionListener(new ActionListener() {
new Reception().setVisible(true);
setVisible(false);
});
btnExit.setBackground(Color.BLACK);
btnExit.setForeground(Color.WHITE);
contentPane.add(btnExit);
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;
ResultSet rs = null;
Choice c1;
/**
*/
EventQueue.invokeLater(new Runnable() {
try {
91
PickUp frame = new PickUp();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
});
this.dispose();
/**
* @throws SQLException
*/
//conn = Javaconnect.getDBConnection();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setContentPane(contentPane);
contentPane.setLayout(null);
92
lblPickUpService.setFont(new Font("Tahoma", Font.PLAIN, 20));
contentPane.add(lblPickUpService);
contentPane.add(lblTypeOfCar);
c1 = new Choice();
try{
while(rs.next()){
c1.add(rs.getString("brand"));
}catch(Exception e){ }
contentPane.add(c1);
contentPane.add(lblInfo);
btnRegister.addActionListener(new ActionListener() {
try{
93
conn c = new conn();
rs = c.s.executeQuery(SQL);
table.setModel(DbUtils.resultSetToTableModel(rs));
ss.printStackTrace();
});
btnRegister.setBackground(Color.BLACK);
btnRegister.setForeground(Color.WHITE);
contentPane.add(btnRegister);
btnExit.addActionListener(new ActionListener() {
new Reception().setVisible(true);
setVisible(false);
});
btnExit.setBackground(Color.BLACK);
btnExit.setForeground(Color.WHITE);
contentPane.add(btnExit);
94
table.setBounds(0, 233, 800, 250);
contentPane.add(table);
contentPane.add(lblNewLabel);
contentPane.add(lblGender);
contentPane.add(lblTypeOfDriver);
contentPane.add(lblDateOfThe);
contentPane.add(lblAirport);
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;
ResultSet rs = null;
Choice c1;
/**
*/
97
EventQueue.invokeLater(new Runnable() {
try {
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
});
this.dispose();
/**
* @throws SQLException
*/
//conn = Javaconnect.getDBConnection();
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
98
setContentPane(contentPane);
contentPane.setLayout(null);
contentPane.add(lblSearchForRoom);
contentPane.add(lblRoomAvailable);
contentPane.add(lblRoomType);
contentPane.add(lblRoomAvailable_1);
contentPane.add(lblPrice_1);
contentPane.add(l1);
checkRoom.setBackground(Color.WHITE);
contentPane.add(checkRoom);
99
c1 = new Choice();
c1.add("Single Bed");
c1.add("Double Bed");
contentPane.add(c1);
btnSearch.addActionListener(new ActionListener() {
try{
rs = c.s.executeQuery(SQL);
table.setModel(DbUtils.resultSetToTableModel(rs));
if(checkRoom.isSelected())
rs = c.s.executeQuery(SQL2);
table.setModel(DbUtils.resultSetToTableModel(rs));
ss.printStackTrace();
100
});
btnSearch.setBackground(Color.BLACK);
btnSearch.setForeground(Color.WHITE);
contentPane.add(btnSearch);
btnExit.addActionListener(new ActionListener() {
new Reception().setVisible(true);
setVisible(false);
});
btnExit.setBackground(Color.BLACK);
btnExit.setForeground(Color.WHITE);
contentPane.add(btnExit);
contentPane.add(table);
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.*;
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);
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
setSize(778,486);
getContentPane().setLayout(null);
add(Passportno);
add(textField);
103
Next.setBounds(200, 420, 150, 30);
Next.setBackground(Color.BLACK);
Next.setForeground(Color.WHITE);
add(Next);
add(Pnrno);
add(textField_1);
add(Gender);
NewRadioButton.setBackground(Color.WHITE);
add(NewRadioButton);
Female.setBackground(Color.WHITE);
add(Female);
104
Address.setBounds(60, 170, 150, 27);
add(Address);
c1 = new JComboBox(course);
c1.setBackground(Color.WHITE);
c1.setBounds(200,170,150,30);
add(c1);
add(Nationality);
add(textField_3);
add(Name);
add(textField_4);
105
add(Phno);
add(textField_5);
add(email);
add(textField_6);
setVisible(true);
AddPassengers.setForeground(Color.BLUE);
add(AddPassengers);
ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/tenth.jpg"));
image.setBounds(410,80,480,410);
add(image);
Next.addActionListener(new ActionListener(){
106
public void actionPerformed(ActionEvent ae){
if(NewRadioButton.isSelected()){
gender = "male";
}else if(Female.isSelected()){
gender = "female";
String s6 = (String)c1.getSelectedItem();
try {
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);
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.*;
JButton b1,b2;
Choice c1;
new AddRoom().setVisible(true);
public AddRoom() {
setContentPane(contentPane);
contentPane.setLayout(null);
ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/twelve.jpg"));
109
ImageIcon i2 = new ImageIcon(i3);
l15.setBounds(400,30,500,370);
add(l15);
contentPane.add(l10);
contentPane.add(l1);
t4 = new JTextField();
contentPane.add(t4);
contentPane.add(l2);
contentPane.add(comboBox);
110
l3.setForeground(new Color(25, 25, 112));
contentPane.add(l3);
contentPane.add(comboBox_2);
contentPane.add(l4);
t2 = new JTextField();
contentPane.add(t2);
contentPane.add(l5);
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.setBackground(Color.BLACK);
b2.setForeground(Color.WHITE);
contentPane.add(b2);
contentPane.setBackground(Color.WHITE);
try{
if(ae.getSource() == b1){
try{
c.s.executeUpdate(str);
112
JOptionPane.showMessageDialog(null, "Room Successfully Added");
this.setVisible(false);
}catch(Exception ee){
System.out.println(ee);
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.*;
JButton b1,b2;
Choice c1;
new AddDrivers().setVisible(true);
public AddDrivers() {
setContentPane(contentPane);
contentPane.setLayout(null);
ImageIcon i1 = new
ImageIcon(ClassLoader.getSystemResource("hotel/management/system/icons/eleven.jpg"));
114
ImageIcon i2 = new ImageIcon(i3);
l15.setBounds(400,30,500,370);
add(l15);
contentPane.add(l10);
contentPane.add(l1);
t1 = new JTextField();
contentPane.add(t1);
contentPane.add(l2);
t2 = new JTextField();
contentPane.add(t2);
115
l3.setForeground(new Color(25, 25, 112));
contentPane.add(l3);
contentPane.add(comboBox);
contentPane.add(l4);
t3 = new JTextField();
contentPane.add(t3);
contentPane.add(l5);
t4 = new JTextField();
contentPane.add(t4);
116
l6.setFont(new Font("Tahoma", Font.BOLD, 14));
contentPane.add(l6);
contentPane.add(comboBox_1);
contentPane.add(l7);
t5 = new JTextField();
contentPane.add(t5);
b1 = new JButton("Add");
b1.addActionListener(this);
b1.setBackground(Color.BLACK);
b1.setForeground(Color.WHITE);
contentPane.add(b1);
b2 = new JButton("Back");
b2.addActionListener(this);
b2.setBackground(Color.BLACK);
b2.setForeground(Color.WHITE);
117
contentPane.add(b2);
contentPane.setBackground(Color.WHITE);
try{
if(ae.getSource() == b1){
try{
c.s.executeUpdate(str);
this.setVisible(false);
}catch(Exception ee){
System.out.println(ee);
118
this.setVisible(false);
}catch(Exception eee){
119
DATABASE
create database hms;
use hms;
Login Database
username varchar(40),
password varchar(40)
);
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
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
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.
This book is excellent for beginners and provides an interactive way to learn Java and GUI
127