Hotal Management System
Hotal Management System
Chapter 1
1. Introduction
1.1. Introduction ............................................................................................. 1
1.2. Objectives ................................................................................................ 1
Chapter 2
2. Survey of Technologies
Chapter 3
3. Requirement & Analysis
4. Program Code
4.1. Code Details and Code Efficiency................................................................... 14
Chapter 5
5. Result and Discussion
5.1. User Documentation ………………............................................................. 30
Chapter 6
6. Testing
6.1. Unit Testing .................................................................................................. 34
6.2. Integration Testing ....................................................................................... 34
6.3. System Testing............................................................................................... 34
6.4. Acceptance Testing ....................................................................................... 34
Chapter 7
7. Conclusion
7.1. Limitations ............................................................................................. 35
1.1. OVERVIEW
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 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 of their work
using computerised 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.
1.2. OBJECTIVES
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 computerised 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
1
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 of their work
using computerised processes. This software application will help admin to handle customer
information, room allocation details, Payment details etc.
● Facilities provided by hotels are fully utilised in an effective and efficient manner.
2
Ch 2. SURVEY OF TECHNOLOGY
IntelliJ IDEA
IntelliJ IDEA is an Integrated Development Environment (IDE) for JVM languages designed
to maximise developer productivity. It does the routine and repetitive tasks for you by
providing clever code completion, static code analysis, and refactorings, and lets you focus
on the bright side of software development, making it not only productive but also an
enjoyable experience.
2.2 Languages
2.2.1 JAVA
2.2.2 MYSQL
Many of the world's largest and fastest-growing organisations including Facebook, Google,
Adobe, Alcatel Lucent and Zappos rely on MySQL to save time and money powering their
high-volume Web sites, business-critical systems and packaged software. Since then, the
performance & scalability, reliability, and ease of use of the world's most popular open source
database, characteristics that made MySQL the #1 choice for web applications, have
relentlessly been improved.
3
Ch 3. REQUIREMENT AND ANALYSIS
To analyse whether the software will meet organisational requirements Feasibility is defined
as the practical extent to which a project can be performed successfully. To evaluate
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 organisation.
To determine whether the software can be integrated with other existing software.benefits
that are expected and to decide will the organisation go for it.
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 organisation 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
User Requirements
There should be software which allocates rooms automatically and maintains records of
customers.
System Requirements
4
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.
1.AWT API was introduced in JDK 1.0. Most of the AWT components have become obsolete
and should be replaced by newer Swing components.
2. 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, Internationalisation, 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.
Software Requirements
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
5
3.4 DATA DICTIONARY
USER TABLE
ROOMS TABLE
ADMIN TABLE
6
3.5 DATA FLOW DIAGRAM
DFD is an important tool used by system analysis. A data flow diagram model, a system
using external entities from which data flows through a process which transforms the data
and creates output data transforms which go to other processes external entities such as files.
The main merit of DFD is that it can provide an overview of what data a system would
process.
7
LEVEL 1 DFD
LEVEL 2 DFD
8
3.6 ER DIAGRAM
9
3.7 Normalisation
Raw database
10
First Normal Form (1NF)
ROOMS TABLE
USER TABLE
11
country varchar(30) NOT NULL
ROOM TABLE
12
USER TABLE
13
Ch 4. PROGRAM CODE
admin.java
package hms;
import net.proteanit.sql.DbUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
public class admin extends JFrame {
Connection conn = null;
private JPanel contentPane;
private JTable table;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
admin frame = new admin();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace(); }
} }); }
14
table = new JTable();
JTableHeader header =table.getTableHeader();
header.setBackground(Color.BLUE);
header.setForeground(Color.WHITE);
table.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
JScrollPane jp= new JScrollPane(table);
jp.setBounds(0, 60, 1100, 400);
jp.setVisible(true);
add(jp);
contentPane.add(jp);
}
bills.java
package hms;
import net.proteanit.sql.DbUtils;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableModel;
15
private JTable table;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Bills frame = new Bills();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace(); }}});}
public Bills() throws SQLException {
checkout.java
package hms;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Paragraph;
16
import com.itextpdf.text.pdf.PdfPTable;
import com.itextpdf.text.pdf.PdfWriter;
import java.io.FileOutputStream;
import java.sql.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost/hms", "root", "");
System.out.println("Successs");
} catch (ClassNotFoundException ex) {
ex.printStackTrace();
t1.setText(s1);t2.setText(s2);t3.setText(s2);t4.setText(s3);
17
t5.setText(s4);t8.setText(s5);
String l=s2;String a=l.substring(0,2);
int n= Integer.parseInt(a);
int n1= Integer.parseInt(date1);
JLabel l1= new JLabel("Name :");
l1.setBounds(35, 180, 200, 14);
contentPane.add(l1);
t1 = new JTextField();
t1.setBounds(250, 180, 150, 20);
contentPane.add(t1);
t1.setColumns(20);
JButton cout = new JButton("Check-out");
cout.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String id=t0.getText();
String d1=t3.getText();
conn c1=new conn();
String q1 = "update room set status = 'empty' where room_number = "+id;
String q2 = "UPDATE customer SET status='cheak out' WHERE room_number =
"+id;
String q3 = "UPDATE customer SET dateout='"+d1+"' WHERE room_number =
"+id;
try{
c1.s.executeUpdate(q2);
c1.s.executeUpdate(q1);
c1.s.executeUpdate(q3);
JOptionPane.showMessageDialog(null, "Check-out Successful");
String path="G:\\";
com.itextpdf.text.Document doc=new com.itextpdf.text.Document();
try{
PdfWriter.getInstance(doc,new FileOutputStream(path+""+id+".pdf"));
doc.open();
Paragraph paragraph0=new Paragraph("\t \t
HOTEL MANAGEMENT SYATEM");
doc.add(paragraph0);
Paragraph paragraph1=new
Paragraph("*****************************************************************
*********************************************");
doc.add(paragraph1);
Paragraph paragraph5=new Paragraph("\t\t GUEST DETAILS \n \n");
doc.add(paragraph5);
18
Paragraph paragraph2=new Paragraph("\t Bill ID:"+id+"\n Name
:"+t1.getText()+"\n Mobile no :"+t4.getText()+"\n Email ID :"+t8.getText());
doc.add(paragraph2);
Paragraph paragraph3=new
Paragraph("*****************************************************************
*********************************************");
doc.add(paragraph3);
Paragraph paragraph10=new Paragraph("\t\t ROOM DETAILS \n \n");
doc.add(paragraph10);
Paragraph paragraph4=new Paragraph("\t Room No:"+t0.getText()+"\n Room
Price :"+t5.getText()+"\n No Of Days :"+t6.getText()+"\n Total Amount :"+t7.getText()+"\n
\n \n \n");
doc.add(paragraph4);
PdfPTable tb=new PdfPTable(4);
tb.addCell("Check-in Date :"+t2.getText());
tb.addCell("Check-out Date :"+t3.getText());
tb.addCell("No Of Days Stayed :"+t6.getText());
tb.addCell("Total Amount Paid :"+t7.getText());
doc.add(tb);
Paragraph paragraph6=new
Paragraph("*****************************************************************
*********************************************");
doc.add(paragraph6);
Paragraph paragraph9=new Paragraph("\t\t THANK YOU,PLEASE VISIT
AGAIN.");
doc.add(paragraph9);
}
catch (DocumentException documentException) {
documentException.printStackTrace();
} catch (FileNotFoundException fileNotFoundException) {
fileNotFoundException.printStackTrace();
}
doc.close();
catch(NumberFormatException s){
JOptionPane.showMessageDialog(null, "Please enter a valid Number");
}}});
cout.setBounds(270, 510, 120, 30);
cout.setBackground(Color.BLACK);
cout.setForeground(Color.WHITE);
}}
19
conn.java
package hms;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.Statement;
public class conn {
Connection c;
Statement s;
PreparedStatement pst;
public conn(){
try{Class.forName("com.mysql.jdbc.Driver");
c =DriverManager.getConnection("jdbc:mysql:///hms","root","");
s =c.createStatement();}catch(Exception e){ System.out.println(e);}
}
}
Dashboard.java
package hms;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
public class Dashboard extends JFrame{
public static void main(String[] args) {
new Dashboard().setVisible(true);
}
public Dashboard() {
super("hotel MANAGEMENT SYSTEM");
setForeground(Color.CYAN);
try{
Checkout customer = new Checkout();
customer.setVisible(true); }
catch (Exception e1){
e1.printStackTrace();} } });
try{
Bills cb = new Bills();
cb.setVisible(true);}catch (Exception e1) {
e1.printStackTrace();}}});
btnNewButton_4.setBounds(550, 20, 170, 50);
20
btnNewButton_4.setIconTextGap(5);
add(btnNewButton_4);
JButton btnNewButton_5 = new JButton("Exit");
btnNewButton_5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try { System.exit(0);
} catch (Exception e1) {
e1.printStackTrace();
}
}
});
btnNewButton_5.setBounds(1000, 20, 150, 50);
btnNewButton_5.setIcon(i005);
btnNewButton_5.setIconTextGap(5);
JButton logout = new JButton("Logout");
logout.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
java.awt.Window win[]=java.awt.Window.getWindows();
for(int i1=0;i1<win.length;i1++)
{ win[i1].dispose();}
new Login().setVisible(true);
} catch (Exception e1) {e1.printStackTrace();}
}});
hms.java
package hms;
import javax.security.auth.login.LoginContext;
import javax.swing.*;
import javax.swing.plaf.ColorUIResource;
import java.awt.*;
import java.awt.event.ActionEvent;
21
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
public hms() {
setSize(1366,768);
setLayout(null);
setLocation(0,0);
b1.setForeground(Color.WHITE);
b1.setFont(new Font("futura", Font.BOLD, 15));
b1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{
}catch(Exception e1){
e1.printStackTrace();
}
}
});
ImageIcon i02 = new
ImageIcon(ClassLoader.getSystemResource("hms/icons/02.png"));
Image i002 = i02.getImage().getScaledInstance(50,50,Image.SCALE_DEFAULT);
ImageIcon i0002 = new ImageIcon(i002);
b2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try{
signup room = new signup();
room.setVisible(true);
}
catch(Exception e){
e.printStackTrace();
}
22
}
});
ImageIcon i03 = new
ImageIcon(ClassLoader.getSystemResource("hms/icons/03.png"));
Image i003 = i03.getImage().getScaledInstance(50,50,Image.SCALE_DEFAULT);
ImageIcon i0003 = new ImageIcon(i003);
login.java
package hms;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.sql.ResultSet;
t2=new JPasswordField();
t2.setBounds(150,70,150,30);
add(t2);
ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("hms/icons/second.jpg"));
23
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);
b2=new JButton("Cancel");
setLocation(400,200);}
public void close()
{
WindowEvent winClose=new
WindowEvent(this,WindowEvent.WINDOW_CLOSING);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winClose);
}
24
}
managerooms.java
package hms;
import net.proteanit.sql.DbUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class manageroom extends JFrame {
JScrollPane jp;
JLabel img;
public manageroom()
{
setSize(600,400);
setDefaultCloseOperation(EXIT_ON_CLOSE);
JTextArea ta=new JTextArea(10,15);
jp=new JScrollPane();
jp.setViewportView(ta);
add(jp);
setVisible(true);
}
frame.add(scrollPane);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400,300);
frame.setVisible(true);
}
}
newcustomer.java
package hms;
import javax.swing.*;
25
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class NewCustomer extends JFrame {
public void close()
{
WindowEvent winClose=new
WindowEvent(this,WindowEvent.WINDOW_CLOSING);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winClose);
}
26
try {
conn c = new conn();
ResultSet rs1 = c.s.executeQuery("select bed_type,rtype,price from room where
room_number = "+i);
if (rs1.next() == true) {
String a = rs1.getString(1);
t03.setText(b);
t02.setText(a);
String id = (String) comboBox1.getSelectedItem();
String idno = t2.getText();
String check = "check in";
String dateout = "0";
String q1 = "insert into customer values('" + id + "','" + idno + "','" + name + "','" + gen +
"','" + cont + "','" + rno + "','"+rprice+"','" + mob + "','" + mail + "','" + date + "','" + dateout +
"','" + check + "')";
c.s.executeUpdate(q1);
String q2 = "update room set status = 'booked' where room_number = " +s6;
c.s.executeUpdate(q2);
JOptionPane.showMessageDialog(null, "Check-in Successful");
setVisible(false);
}}
27
signup.java
package hms;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;
getContentPane().setBackground(Color.WHITE);
setVisible(true);
setSize(600, 300);
setLocation(400, 200);
b1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
conn c =new conn();
String user, password,password2;
user = t1.getText();
password = t2.getText();
password2 = t3.getText();
if(password2.compareTo(password)==0 ) {
try {
String q1 = "insert into login values('"+user+"','"+password+"')";
c.s.executeUpdate(q1);
JOptionPane.showMessageDialog(null, "Signup done successful !");
t1.setText("");
t2.setText("");
t1.requestFocus();
setVisible(false);
Login ob = new Login();
} catch (SQLException e1) {
e1.printStackTrace();
28
}
} else
{
JOptionPane.showMessageDialog(null, "Re-enter Password");
}
} });}
public static void main (String[]arg) {new signup();}
@Override
public void actionPerformed(ActionEvent e) {System.exit(0);}
}
update.java
package hms;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
public class update extends JFrame {
private JPanel contentPane;
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
update frame = new update();
frame.setVisible(true);
} catch (Exception e) {e.printStackTrace();}}});}
29
Ch 5. RESULT AND DISCUSSION
30
31
32
33
Ch 6. TESTING
Unittesting 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 is the technique in which individual components or modules are grouped
together and tested. It occurs after testing. The inputs for the integrated testing are the
modules that have already been unit tested.
System testing is conducted on the entire system as a whole to check whether the system
meets its requirements or not. software was installed on different systems and any errors or
bugs that occurred were fixed.
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. Thistesting happens in the final phase
of testing before moving the software application to the Market or Production environment.
34
Ch 7. CONCLUSION
7.1. LIMITATIONS
● The size of the database increases day-by-day, increasing the load on the database
backup and data maintenance activity.
● Training for simple computer operations is necessary for the users working on the
system.
● It doesn't have any industrial implementation, it is just applicable for small hotels to
maintain details and for providing bills to the customer.
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 analyse the user behaviour and preferences and accordingly
suggest. All concepts can be applied to make the Hotel Management System more efficient.
7.3. CONCLUSION
It has been a great pleasure for me to work on this exciting and challenging project. This
project proved good for me as it provided practical knowledge of not only programming in
JAVA and MySQL based applications.
It also provides knowledge about the latest technology used in development.e. This will
provide better opportunities and guidance in future in developing projects independently.
35
7.4. REFERENCES
❖ For Java
➢ https://www.jetbrains.com
❖ For MySQL
➢ https://www.mysql.com
➢ http://www.mysqltutorial.org
❖ For XAMPP
➢ https://www.apachefriends.org/download.html
36