0% found this document useful (0 votes)
4 views

Hotal Management System

The document outlines the development of a Hotel Management System aimed at automating hotel operations such as customer management, room allocation, and payment processing. It includes sections on technology surveys, requirements analysis, program code, and testing methodologies. The project utilizes Java and MySQL, and emphasizes user-friendly interfaces and efficient data management.

Uploaded by

sreeaswinkumar10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Hotal Management System

The document outlines the development of a Hotel Management System aimed at automating hotel operations such as customer management, room allocation, and payment processing. It includes sections on technology surveys, requirements analysis, program code, and testing methodologies. The project utilizes Java and MySQL, and emphasizes user-friendly interfaces and efficient data management.

Uploaded by

sreeaswinkumar10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

TABLE OF CONTENTS

Chapter 1

1. Introduction
1.1. Introduction ............................................................................................. 1
1.2. Objectives ................................................................................................ 1

Chapter 2

2. Survey of Technologies

2.1. IntelliJ IDEA ............................................................................................. 3


2.2. Languages ................................................................................................. 3
2.2.1. java .................................................................................................. 3
2.2.2. MySOL............................................................................................ 3

Chapter 3
3. Requirement & Analysis

3.1. Feasibility Study ….…………………......................................................... 4


3.2 Requirement Specification ........................................................................... 4
3.3. Hardware and Software Requirements ....................................................... 5
3.4. Data Dictionary ...........................................................................................
6
3.5. DFD ............................................................................................................
7
3.5.1. Context Level DFD ............................................................................
7
3.5.2. DFD Level 1 .......................................................................................
8
3.5.3. DFD Level 2 .......................................................................................
8
3.6. ER-Diagram .................................................................................................
9
3.7. Normalization ..............................................................................................
10
Chapter 4

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

7.2. Future Scope ........................................................................................... 35


7.3. Conclusion .............................................................................................. 35
7.4. References ............................................................................................... 36
Ch 1. INTRODUCTION

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.

● Keeping records of admission of customers.

● Facilities provided by hotels are fully utilised in an effective and efficient manner.

2
Ch 2. SURVEY OF TECHNOLOGY

2.1. SOFTWARE DESCRIPTION

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

Java is a class-based, object-oriented programming language and is designed to have as few


implementation dependencies as possible. A general-purpose programming language made
for developers to write once run anywhere that is compiled Java code can run on all platforms
that support Java. Java applications are compiled to byte code that can run on any Java
Virtual Machine.

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

3.1 FEASIBILITY STUDY

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.

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 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

3.2 REQUIREMENT SPECIFICATION

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.

3.3 HARDWARE AND SOFTWARE REQUIREMENTS

Software Requirements

● Operating System Windows 10


● Front End Java, IntelliJ IDEA
● Back End MySQL

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.

• A data-flow diagram is a way of representing a flow of data through a process or a system.


• The DFD also provides information about the outputs and inputs of each entity and the
process itself.

CONTEXT LEVEL DFD

7
LEVEL 1 DFD

LEVEL 2 DFD

8
3.6 ER DIAGRAM

9
3.7 Normalisation

Raw database

Column name Data type Key constraints

id varchar(30) NOT NULL

number varchar(30) Primary Key NOT NULL

name varchar(30) NOT NULL

gender varchar(30) NOT NULL

country varchar(30) NOT NULL

room_number Int(11) Primary Key NOT NULL

room_price Int(11) NOT NULL

mob1 varchar(30) NOT NULL

mob2 varchar(30) NOT NULL

email varchar(30) NOT NULL

datein varchar(30) NOT NULL

dateout varchar(30) NOT NULL

status varchar(30) NOT NULL

bed_type varchar(30) NOT NULL

rtype varchar(30) NOT NULL

username varchar(30) Primary Key NOT NULL

password varchar(30) NOT NULL

10
First Normal Form (1NF)

Admin Login Table

Column name Data type Key constraints

username varchar(40) Primary Key NOT NULL

password varchar(40) NOT NULL

ROOMS TABLE

Column name Data type Key constraints

room_number Int(11) Primary Key NOT NULL

status varchar(30) NOT NULL

room_price Int(11) NOT NULL

bed_type varchar(30) NOT NULL

rtype varchar(30) NOT NULL

USER TABLE

Column name Data type Key constraints

id varchar(30) NOT NULL

number varchar(30) Primary Key NOT NULL

name varchar(30) NOT NULL

gender varchar(30) NOT NULL

11
country varchar(30) NOT NULL

room_number Int(11) NOT NULL

room_price Int(11) NOT NULL

mob1 varchar(30) NOT NULL

mob2 varchar(30) NOT NULL

email varchar(30) NOT NULL

datein varchar(30) NOT NULL

dateout varchar(30) NOT NULL

status varchar(30) NOT NULL

Second Normal Form (2NF)

ROOM TABLE

Column name Data type Key constraints

room_number Int(11) Primary Key NOT NULL

status varchar(30) NOT NULL

bed_type varchar(30) NOT NULL

rtype varchar(30) NOT NULL

ROOM PRICE TABLE

Column name Data type Key constraints

room_number Int(11) Primary Key NOT NULL

room_price Int(11) NOT NULL

12
USER TABLE

Column name Data type Key constraints

id varchar(30) NOT NULL

number varchar(30) Primary Key NOT NULL

name varchar(30) NOT NULL

gender varchar(30) NOT NULL

country varchar(30) NOT NULL

mob1 varchar(30) NOT NULL

mob2 varchar(30) NOT NULL

email varchar(30) NOT NULL

USER ROOM DETAILS TABLE

Column name Data type Key constraints

number varchar(30) Primary Key NOT NULL

room_number Int(11) NOT NULL

room_price Int(11) NOT NULL

datein varchar(30) NOT NULL

dateout varchar(30) NOT NULL

status varchar(30) NOT NULL

13
Ch 4. PROGRAM CODE

4.1. CODE DETAILS AND CODE EFFICIENCY

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(); }
} }); }

public admin() throws SQLException {


setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(170, 125, 1100, 600);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);

JLabel lblName = new JLabel("Admins ");


lblName.setFont(new Font("Yu Mincho", Font.BOLD, 40));
lblName.setBounds(40, 0, 260, 53);
contentPane.add(lblName);

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);

conn c = new conn();


String displayCustomersql = "select * from login ";
ResultSet rs = c.s.executeQuery(displayCustomersql);
table.setModel(DbUtils.resultSetToTableModel(rs));

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


btnLoadData.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{
conn c = new conn();
String displayCustomersql = "select * from login ";
ResultSet rs = c.s.executeQuery(displayCustomersql);
table.setModel(DbUtils.resultSetToTableModel(rs));}
catch(Exception e1){
e1.printStackTrace();}
getContentPane().setBackground(Color.WHITE);
}

}
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;

public class Bills extends JFrame {


Connection conn = null;
private JPanel contentPane;

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 {

conn c = new conn();


String displayCustomersql = "select * from customer ";
ResultSet rs = c.s.executeQuery(displayCustomersql);
table.setModel(DbUtils.resultSetToTableModel(rs));

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


btnLoadData.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try{
conn c = new conn();
String displayCustomersql = "select * from customer ";
ResultSet rs = c.s.executeQuery(displayCustomersql);
table.setModel(DbUtils.resultSetToTableModel(rs));}
catch(Exception e1){e1.printStackTrace();}
}});
}

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


ImageIcon i2 = new ImageIcon(i3);
JLabel l1 = new JLabel(i2);
l1.setBounds(0,0,1366,600);
add(l1);
getContentPane().setBackground(Color.WHITE);
}}

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;

public class Checkout 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 {
Checkout frame = new Checkout();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
Connection con;
public void connect() {

try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost/hms", "root", "");
System.out.println("Successs");
} catch (ClassNotFoundException ex) {
ex.printStackTrace();

} catch (SQLException ex) {


ex.printStackTrace();
}}

JLabel lblName = new JLabel("CHECK-OUT ");


lblName.setFont(new Font("Yu Mincho", Font.BOLD, 40));
lblName.setBounds(118, 11, 260, 53);
contentPane.add(lblName);

JButton sc = new JButton("Search");


sc.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {

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();}
}});

JLabel AirlineManagementSystem = new JLabel("Hotel Management System");


AirlineManagementSystem.setForeground(Color.WHITE);
NewLabel.add(AirlineManagementSystem);
setSize(1366,768);
setVisible(true);
getContentPane().setBackground(Color.WHITE);
}

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 class hms extends JFrame implements ActionListener{

public void close()


{
WindowEvent winClose=new WindowEvent(this,WindowEvent.WINDOW_CLOSING);
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(winClose);
}

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{

Login custom = new Login();


custom.setVisible(true);

}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);

catch (Exception e1){


e1.printStackTrace();
}
}
});
b4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
admin frame = new admin();
frame.setVisible(true);} catch (Exception e1) {e1.printStackTrace();}

public void actionPerformed(ActionEvent ae){


new Login().setVisible(true);}

public static void main(String[] args) {


hms window = new hms();
window.setVisible(true);
}
}

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;

public class Login extends JFrame implements ActionListener{

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);
}

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()){java.awt.Window
win[]=java.awt.Window.getWindows();
for(int i=0;i<win.length;i++)
{win[i].dispose();}
new Dashboard().setVisible(true);}
else{
JOptionPane.showMessageDialog(null, "Invalid login");
t1.setText("");
t2.setText("");
setVisible(true);
}
}catch(Exception e){
e.printStackTrace();
}
}else if(ae.getSource()==b2){
System.exit(0);
}
}
public static void main(String[] arg){
new Login();
}

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);
}

public static void main(String[] args) {


new manageroom();
JFrame frame=new JFrame();
frame.setLayout(new FlowLayout());
JTextArea ta=new JTextArea(10,15);
JScrollPane scrollPane=new
JScrollPane(ta,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,ScrollPaneConstants.HO
RIZONTAL_SCROLLBAR_ALWAYS);

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);
}

public static void main(String[] args) {


EventQueue.invokeLater(new Runnable() {
public void run() {
try {
NewCustomer frame = new NewCustomer();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}}):}
public NewCustomer() throws SQLException {
setBounds(270, 125, 850, 550);

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 where status = 'empty'");//where
gender = 'Male'
while(rs.next()){
c1.add(rs.getString("room_number"));
}
}catch(Exception e){ }
c1.setBounds(271, 274, 150, 20);
contentPane.add(c1);
JLabel email = new JLabel("E-mail ID :");
email.setBounds(35, 316, 200, 14);
t7.setColumns(10);

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);

} catch (SQLException e1) {


System.out.println(e1.getMessage());
} catch (NumberFormatException s) {
JOptionPane.showMessageDialog(null, "Please enter a valid Number");
}}):}
btnExit.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
close();
setVisible(false);
}}):}
btnExit.setBounds(260, 430, 120, 30);
btnExit.setBackground(Color.BLACK);
btnExit.setForeground(Color.WHITE);
contentPane.add(btnExit);
ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("hms/icons/2.png"));
Image i3 = i1.getImage().getScaledInstance(1000, 1000,Image.SCALE_DEFAULT);
ImageIcon i2 = new ImageIcon(i3);
JLabel l1 = new JLabel(i2);
l1.setBounds(0,0,850,550);
add(l1);

}}

27
signup.java

package hms;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;

public class signup extends JFrame implements ActionListener {


signup() {
super("Signup");
setLayout(null);
l1 = new JLabel("Username");
l1.setBounds(40, 20, 100, 30);
b1 = new JButton("Signup");
b1.setBounds(40, 200, 120, 30);
add(b1);

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();}}});}

JButton cout = new JButton("Check-out");


cout.addActionListener(new ActionListener() {public void
actionPerformed(ActionEvent e) {
String id="1000";
conn c1=new conn();
String q1 = "update customer set ck = 'out' where room_price = "+id;
try{c1.s.executeUpdate(q1);JOptionPane.showMessageDialog(null, "Check-out Successful");
}catch(SQLException e1){
System.out.println(e1.getMessage());
}
catch(NumberFormatException s){
JOptionPane.showMessageDialog(null, "Please enter a valid Number");
} }});
cout.setForeground(Color.WHITE);
contentPane.add(cout);
}}

29
Ch 5. RESULT AND DISCUSSION

5.1 USER DOCUMENTATION

30
31
32
33
Ch 6. TESTING

6.1 Unit 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

6.2 Integration Testing

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.

6.3 System Testing

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.

6.4 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. 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.

7.2. 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 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

You might also like