Hotel Documentation

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 253

Hotel management system 226653

1. INTRODUCTION

Hotel Management System is a system that provides us to reserving rooms, checking whether
the rooms are vacant are or not etc by using online browsing. This system is very useful to all
especially for business people.
For Business people they don’t have sufficient time for these then they can use these type of
online Hotel Management Systems. By this project we will reduce the faults in bills of their
expenditure and decrease time of delayto give the bills to the customers. We can also save the
bills of the customer. By this project we can also include all the taxes on the bills according to
their expenditures. It has a scope to reduce the errors in making the bills. Computerized bill
can be printed within fraction of seconds. Online ordering of Booking is possible by using
this software. This Project is based on php. If any one wants to book the room for few days
then they can specify the specific number by seeing the types of rooms we have. The bill of
this online booking is based on the type of room they can select is displayed.
HOTEL MANAGEMENT SYSTEM is a hotel reservation site script where site users will be
able to search rooms availability with an online booking reservations system.Siteusers can
also browse hotels, view room inventory, check availability, and book reservations in real-
time.Site users enter check in date and check out date then search for availability and rates.
After choosing the right room in the wanted hotel – all booking and reservation process is
done on the site and an SMS is sent to confirm the booking

users can also browse hotels, view room inventory, check availability, and book reservations
in real-time.Site users enter check in date and check out date then search for availability and
rates. After choosing the right room in the wanted hotel – all booking and reservation process
is done on the site and an SMS is sent to confirm the booking.

1.1 Problem Definition:

Saket College of arts,science and commerce 1


Hotel management system 226653

The present scenario offers manual data entry. A lot of time is wasted in creating the reports as
well as maintaining them. In case, if any query arises to get the information about the
booking, queries and registered users, the whole report is re-typed or xeroxed. This seriously
affects the authentication of the system. This kind of hotel management system is totally
outdated and involves high risk of ambiguity and redundancy.

1.2 Objective:

Project title “Hotel Management” (a project for keeping customers record and also
calculate customer bill slip and managers salary).
1. The objective of the project is to computerize the system of the hotel.
2. “Hotel Management”is the project not only keeps the record of various users like
customers, manager etc. but as well as it reduce the extensive paper work in the
present system.
3. It wills maker the system more versatile and user friendly.
4. It also calculates the proper billing slip of high level and middle level customers. 5.
It maintains the database and also allows Adding new employee details, daily
attendance, and salary calculation of the employee.
6. This system generates a report which will be having details of daily transaction.

1.3 Scope of the Project

This application can be easily implemented under various situations. We can add new
features as and when require. Reusability is possible as and when require in this
application. There is flexibility in all the modules. The software to be developed deals
with creating a Hotel Management system which will automate the major hotel
operations such as generating COD, billing and keeping track of records of daily

Saket College of arts,science and commerce 2


Hotel management system 226653

transaction.Admin have the authority to control and modify the database. The project
has a wide scope, as it is not intended to a particular organization. This project is going
to develop generic software, which can be applied by any businesses organization.
More over it provides facility to its customer. Also the software is going to provide a
huge amount of summary data. At present this software does not contain Credit card
facility. We can make this application as online so that we can reserve the tables and do
the online payment. So as the demand increases we can add these modules as a future
scope. At present this software does not contain Credit card facility. We can make this
application as online so that we can reserve the tables and do the online payment. So as
the demand increases we can add these modules as a future scope.

1.4 Limitations of the Project

As earlier mentioned the project study covers Reception, accommodation, finance and
account, catering, food ordering, administrative, security, and general services transactions in
the Hotel management.
However The project has limitation based on these facts
1. It is not a large Scale System.Only Limited information will be Provided By the
System.
2. At present this software does not contain Credit card facility. We can make this
application as online so that we can reserve the tables and do the online payment. So as the
demand increases we can add these modules as a future scope.
3. The transactions are executed in off-line mode.
4. Due to time constraints certain fields were not included; the software was therefore
reduced to covering critical aspect of hotel management.
4. People who are with computers can’t use this software.
5. If there is a power failure, the hotel runs a high risk of loosing all the stored
informations.

Saket College of arts,science and commerce 3


Hotel management system 226653

1.5Project Plan and Gantt


chart:

1.6Process Model:
The model followed in this project of Hospital Management System is Spiral Model.
Spiral Model is one of the most important Software Development Life Cycle Models, which
providessupportforriskhandling.
Initsdiagrammatic
representation,
it lookslikea spiralwith
many loops. the exact number of loops of the spiral is unknown and can vary from project to
project.Eachloopofthespiralis calleda phaseofthesoftwaredevelopment
process.Theexact
number of phases needed to develop the product can be varied by the project manager
depending upon the project risks. As the project manager dynamically determines the number
of phases, so the project manager has an important role to develop a project
e spiral
using th
Model.

Saket College of arts,science and commerce 4


Hotel management system 226653

Saket College of arts,science and commerce 5


Hotel management system 226653

2. SYSTEM ANALYSIS

2.1 General
• Multi-core – 1.8 GHz processor or better
• 4GB RAM
• Windows 7, 8, 8.1, 10, or 11
• 80 GB hard drive or more (160 GB highly recommended)
• Mouse
• Monitor with 1024 X 768 resolution or higher
• Windows compatible printer (laser printer recommended)
• Gigabit Ethernet port and router (for networking computers)**
• 1 serial port or a USB to serial adapter (only required for certain software options)
• Wired, high speed internet connection (only required for certain software/service
options)

2.2 Existing System


Various problems of physical system are described below:-

The existing system of Hotel Management was manual. All the daily routines are carried out
manually and the records are maintained in the record books or the registers.As computer has
merged with man as single entity so a computerized application can be developed that can
handle Hotel Management System(HMS). All the above activity such as Booking,Customer
Check In,Bill Generations,Making Reports takes place manually, manually carrying out this
activity in very tedious time consuming. As we have tried to develop computerized
application so as to handle all the activity that takes place in Hotel. As all the activities that
happen in the Hotel such as enquiry, check status booking, etc. can be handled on this system
simultaneously.

2.2.1 Limitation of Existing System

1. Existing keyword suggestion techniques do not consider the locations of the users
and the query results; i.e., the spatial proximity of a user to the retrieved results is not taken
as a factor in the recommendation.

2. However, the relevance of search results in many applications (e.g., location-based


services) is known to be correlated with their spatial proximity to the query issuer 3. The
booking process usually requires a customer identity, which the system cannot detect.

4. Coordinating various departments in this respect is not only time taking but is also a

Saket College of arts,science and commerce 6


Hotel management system 226653

cumbersome process.

5. The system is not deprived of common manual mistakes.

6. The system is also prone to insecurities.

7. This manuål does not help Head of the hotel in taking decisions at various levels.

All above points define the disadvantages of conventional methods & suggest developing the
new system.

2.3 Proposed System


To remove all the disadvantages of conventional methods, a system is proposed which is an
automation of Hotel Management System.
Hotel Management System is a project to mamtain the record of Hotel Management System
activities. There are various type of activities performed in dayshift & nightshift. So this
Hotel Management System is used to computerlze all these activities.
There are two kinds of users:
l) Admin 2) General User

With the help of this project we reduced task deployed for data/information collection
to a large extent thereby elllülnating the human errors considerably.

Therefore the organization has realized the need for automating the various daily
routine activities of hotel & task of data/information collection with the help of database
designing.
And with this realization our project "HOTEL MANAGEMENT SYSTEM" comes
into practical usage & also benefiting the organization as a whole.

Everything that comes into existence must have an objective for its existence. It holds
true for our project also. It has been conceived as a powerful tool to help the company in
maintaming the various activities of the hotel. It has several benefits over other already
existing applications.

Saket College of arts,science and commerce 7


Hotel management system 226653

2.3.1 Advantage of Proposed System

1. This LKS framework providing keyword suggestions that are relevant to the user
information needs and at the same time can retrieve relevant documents near the user
location.

2. Easy search of all records.

3.Avoid the manual work.

4. The system is useful as it calculates an exact cost of rooms for requested number of days.

5. This system is effective and saves time and cost of users.

6. It saves organization resources and expenses.

7. Reduction in cycle time till the updated data will be available.

8. Speedy retrieval of data.

9. Back up facility provided in case of data loss

2.4 System Analysis

2.4.1 Problem Defining

The present scenario offers manual data entry. A lot of time is wasted in creating the reports as
well as maintaining them. In case, if any query arises to get the information about the
booking, queries and registered users, the whole report is re-typed or xeroxed. This seriously
affects the authentication of the system. This kind of hotel management system is totally
outdated and involves high risk of ambiguity and redundancy.

2.4.2 Feasibility Study


The objective of feasibility study is to determine whether or not the proposed system is
feasible.
The feasibility is determined in terms of three aspects. These are:-

2.4.2.1. Technical Feasibility

Saket College of arts,science and commerce 8


Hotel management system 226653

In this, one has to test whether the system can be developed using existing technology or not.
We have used Visual Basic as front-end and MS ACCESS as back-end. It is evident that
necessary hardware and software are available for development and implementation of

Saket College of arts,science and commerce 9


Hotel management system 226653

proposed system. We acquired the technical knowledge of working in Visual Basic language,
and then only we have started designing our project.

2.4.2.2. Behavioral Feasibility:

The hotels are already using various software for managing their information and since it is
acceptable by both hotel administration as well as hotel staff, it is proven to be operationally
feasible.

2.4.2.3. Economical feasibility:

As a part of this, the costs and benefits associated with the proposed system are compared and
the project is economically feasible only if tangible and intangible benefits outweigh the cost.
The cost for proposed hotel management system is outweighing the cost and efforts involved
in maintaining the registers, books, files and generation of various repotts. The system also
reduces the administrative and technical staff to do various jobs that smgle software can do.
So, th1S system is economically feasible.

2.4.2.4. Legal Feasibility:

Legal feasibility detennines whether the proposed system conflicts with legål requirements,
e.g.
the Data Protection Act. It Will be done by some legal advisory

2.5 System Requirements

Requirement analysis for java application encompasses The proposed Hotel Booking
Management System is to have everything completely automated and computerized.
The software is very easy to use and manage even for a non technical person. The
redundancy and ambiguity will be removed by assigning every booking a unique
number (i.e Booking Number).three major tasks:Formulation,requirements gathering
and analysis modeling.During formulation,the basic motivation and goals for the java
application are identified, and the categories of users are defined.In the requirements
gathering phase,the content and functional requirements are listed and interaction
scenarios written from end users point of view are developed .This intent is to
establish a basic understanding of why the java application are built ,who will use
it ,and what problems it will solve for its users.

2.5.1 Software Requirement Specification


A set of programs assosciated with the operation of computer is called

Saket College of arts,science and commerce 10


Hotel management system 226653

software.Software is the part of Computer System ,which enables the users to interact
with several physical hardware devices.
The minimum software requirement specification for developing this project are as
follows:

• Microsoft Windows 7/8/10.


• JDK(Java Development Kit)
• Netbeans IDE
2.5.2 Hardware Requirements Specification:

The Collection of internal electronic circuits and external physical devices used in
building a computer is called the Hardware.
The Minimum Hardware Requirement specuification for developing this project are as
follows:
• Intel Processor 2.0 GHz or above.

• 1GB RAM or more.

• 80 GB or more Hard Disk Drive

3. SYSTEM DESIGN
Saket College of arts,science and commerce 11
Hotel management system 226653

3.1 USE CASE DIAGRAM:


A use case describes a sequence of actions that provide something of measurable value to an
actor and is drawn as a horizontal ellipse an actor is a person, organization, or external system
that plays a role in one or more interactions with your system.
Use Case Diagram
A use case diagram is a diagram that shows a set of use cases and actors and relationships.
Contents
1.Use case commonly contain
2.Use cases
3. Actors
4. Dependency, generalization and association relationships

Saket College of arts,science and commerce 12


Hotel management system 226653

Signin
ADMINISTRATOR:

Home

Add Facility

Manage Room

Manage Facility

Add Room

Manage Room
(Add/Update

Manage Booking

Manage Enquiry

Generate Reports

Search

Update Profile

Change Password

Saket College of arts,science and commerce 13


Hotel management system 226653

3.2 DFD (Data Flow


Diagram)

A data-flow diagram (DFD) is a way of representing a flow of a data of a process or a


system (usually an information system). The DFD also provides information about the
outputs and inputs of ea
ch entity and the process itself. A data
-flow diagram has no
controlflow,there are no decision rules and no loops. Specific operations based on the
data can be represented by a flowchart.

The data-flow diagram is part of the structured


-analysis modellin
g tools. When using
UML, the activity diagram typically takes over the role of the-flow
datadiagram. A
special form of data
-flow plan is a site
-oriented data

DFD Level 0:
-

Hotel Reservation
Customer Management Subsystem
System

DFD Level1:

2
1 Choosefacility Book Room Hotel
Facilities Monitor Process Get Confirmation Customer
Customer
Reservation Registration
Get Feedback
Send Send Provide
Confirmation Request Data

3 Change data
Cancellation Database
And
Reservation

14
Hotel management system 226662

Saket College of arts,science and commerce

Saket College of arts,science and commerce


15
Hotel management system 226653

16
Hotel management system 226662

Saket College of arts,science and commerce

Saket College of arts,science and commerce


17
Hotel management system 226653

3.3 ER DIAGRAM
Entity – Relationship Diagram: This depicts relationship between data
objects. The attribute of each data o bjects noted in the entity- relationship
diagram can be described using a data object description. Data flow
diagram serves two purposes:
1. To provide an indication of how data are transformed as they move
through the system.
2. To depict the functions that transformation the data flow

Room No
ID

Room Type
Name
Hotel Has Rooms
Price
Location

Bed Type
Phone
Number

Reserve

Name
Bill ID

Email ID

Amount Bill Pay Customer


Phone
Number

P_method

Identity
proof
Address

18
Hotel management system 226662

Saket College of arts,science and commerce 19


Hotel management system 226662

3.4 SEQUENCE DIAGRAMS:


UML sequence diagrams model the flow of logic within your system in a visual manner,
enabling you both to document and validate your logic, and are commonly used for both
analysis and design purposes. Sequence diagrams are the most popular UML artifacts for
dynamic modeling, which focuses on identifying the behavior within your system

Sequence and diagrams


Sequence Diagram
An interaction diagram shows an interaction, consisting of a set of objects and their
relationships, including the messages that may be dispatched among them.
A sequence diagram is an interaction diagram that emphasizes the time ordering of messages
.Graphically, a sequence diagram is a table that shows objects arranged along x-axis and
messages, ordered in increasing time, along the y-axis. ContentsSequence diagrams
commonly contain the following:
Objects
Links
Messages
Like all other diagrams, sequence diagrams may contain notes and
constrains.

Saket College of arts,science and commerce 20


Hotel management system 226662

Saket College of arts,science and commerce 21


Hotel management system 226662

3.5Class Diagram

A classdiagramdescribes
thestaticstructureofthesymbolsin yournewsystem.It is a graphic
presentation of the static view that shows a collection ofve declarati
(static) model elements,
such as classes, types, and their contents and relationships. Classes are arranged in hierarchies
sharing common structure and behavior, and are associated
other with

Saket College of arts,science and commerce 22


Hotel management system 226662

4. OUTPUT SCREENS:

SIGNUP PAGE:

LOGIN PAGE

Saket College of arts,science and commerce 23


Hotel management system 226662

FORGOT PASSWORD PAGE :

MANAGE ROOM :

Saket College of arts,science and commerce 24


Hotel management system 226662

CUSTOMER CHECKIN:

CUSTOMER CHECKOUT:

Saket College of arts,science and commerce 25


Hotel management system 226662

BILL DETAILS OF CUSTOMER:

Saket College of arts,science and commerce 26


Hotel management system 226662

Saket College of arts,science and commerce 27


Hotel management system 226662

5. SYSTEM IMPLEMENTATION:

5.1 Introduction:
Implementation is the stage of the project when the theoretical design is turned out into a
working system. Thus, it can be most critical stage in achieving a successful new system and
in giving the user, confidence that the new system will work and be effective.
The implementation stage involves careful planning, investigation of the existing system
and it’s constraints on implementation, designing of methods to achieve changeover and evaluation

of changeover methods.

5.2 Code: Signup.java:

import javax.swing.JOptionPane; import

Project.InsertUpdateDelete; import

java.awt.Color; import

java.util.regex.Matcher; import

java.util.regex.Pattern; import

javafx.scene.control.Alert; import

java.awt.event.KeyEvent; import

javafx.scene.control.Alert.AlertType;

public class signup extends javax.swing.JFrame {

/**

* Creates new form SIGNUP

*/

Saket College of arts,science and commerce 28


Hotel management system 226662

Saket College of arts,science and commerce 29


Hotel management system 226662

public signup() { initComponents();

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jLabel1 = new javax.swing.JLabel(); jLabel2 =


new javax.swing.JLabel(); jLabel3 = new
javax.swing.JLabel(); jLabel4 = new
javax.swing.JLabel(); jLabel5 = new
javax.swing.JLabel(); jLabel6 = new
javax.swing.JLabel(); jTextField1 = new
javax.swing.JTextField(); jTextField2 = new
javax.swing.JTextField(); password = new
javax.swing.JPasswordField(); jComboBox1 =
new javax.swing.JComboBox<>(); jTextField3 =
new javax.swing.JTextField(); jTextField4 = new
javax.swing.JTextField(); jLabel7 = new
javax.swing.JLabel(); jButton1 = new
javax.swing.JButton(); jButton2 = new
javax.swing.JButton(); jButton3 = new
javax.swing.JButton();

Saket College of arts,science and commerce 30


Hotel management system 226662

Saket College of arts,science and commerce 31


Hotel management system 226662

jButton4 = new javax.swing.JButton();

elab = new javax.swing.JLabel();

adlab = new javax.swing.JLabel();

pass = new javax.swing.JLabel();

jLabel8 = new javax.swing.JLabel();

anslab = new javax.swing.JLabel();

jLabel9 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setUndecorated(true); getContentPane().setLayout(new

org.netbeans.lib.awtextra.AbsoluteLayout());

jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("Name");

getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(500,


230, -1, -1));

jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("Email");

getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(500,


270, 40, -1));

jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel3.setForeground(new


java.awt.Color(255, 255, 255));

Saket College of arts,science and commerce 32


Hotel management system 226662

Saket College of arts,science and commerce 33


Hotel management system 226662

jLabel3.setText("Password");

getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(500,


310, -1, 10));

jLabel4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jLabel4.setForeground(new java.awt.Color(255, 255, 255)); jLabel4.setText("Security

questions");

getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(500,


360, -1, 20));

jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jLabel5.setForeground(new java.awt.Color(255, 255, 255)); jLabel5.setText("Answer");

getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(500,


410, -1, -1));

jLabel6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jLabel6.setForeground(new java.awt.Color(255, 255, 255)); jLabel6.setText("Address");

getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(500,


440, -1, 40));

jTextField1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jTextField1.addActionListener(new java.awt.event.ActionListener()

{ public void actionPerformed(java.awt.event.ActionEvent evt)

{ jTextField1ActionPerformed(evt);

Saket College of arts,science and commerce 34


Hotel management system 226662

Saket College of arts,science and commerce 35


Hotel management system 226662

});

jTextField1.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyReleased(java.awt.event.KeyEvent evt)

{ jTextField1KeyReleased(evt);

} public void keyTyped(java.awt.event.KeyEvent evt)

{ jTextField1KeyTyped(evt);

});

getContentPane().add(jTextField1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(650, 230, 201, -1));

jTextField2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jTextField2.addActionListener(new java.awt.event.ActionListener()

{ public void actionPerformed(java.awt.event.ActionEvent evt)

{ jTextField2ActionPerformed(evt);

});

jTextField2.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyPressed(java.awt.event.KeyEvent evt)

{ jTextField2KeyPressed(evt);

} public void keyReleased(java.awt.event.KeyEvent

evt) { jTextField2KeyReleased(evt);

} public void keyTyped(java.awt.event.KeyEvent evt)


{

Saket College of arts,science and commerce 36


Hotel management system 226662

Saket College of arts,science and commerce 37


Hotel management system 226662

jTextField2KeyTyped(evt);

});

getContentPane().add(jTextField2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(650, 270, 201, -1));

password.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

password.addActionListener(new java.awt.event.ActionListener() { public

void actionPerformed(java.awt.event.ActionEvent evt)

{ passwordActionPerformed(evt);

});

password.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyReleased(java.awt.event.KeyEvent evt)

{ passwordKeyReleased(evt);

} public void keyTyped(java.awt.event.KeyEvent evt)

{ passwordKeyTyped(evt);

});

getContentPane().add(password, neworg.netbeans.lib.awtextra.AbsoluteConstraints(650,
310, 201, -1));

jComboBox1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] {


"who is your favourite actor?", "who is Your best friend?", "what is your birth Place?" }));
getContentPane().add(jComboBox1, org.netbeans.lib.awtextra.AbsoluteConstraints(650,

Saket College of arts,science and commerce 38


Hotel management system 226662

Saket College of arts,science and commerce 39


Hotel management system 226662

360, -1, -1));

jTextField3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jTextField3.addActionListener(new java.awt.event.ActionListener()

{ public void actionPerformed(java.awt.event.ActionEvent evt)

{ jTextField3ActionPerformed(evt);

});

jTextField3.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyReleased(java.awt.event.KeyEvent evt)

{ jTextField3KeyReleased(evt);

} public void keyTyped(java.awt.event.KeyEvent evt)

{ jTextField3KeyTyped(evt);

} });

getContentPane().add(jTextField3, org.netbeans.lib.awtextra.AbsoluteConstraints(650,
400, 201, 30));

jTextField4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jTextField4.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyReleased(java.awt.event.KeyEvent evt)

{ jTextField4KeyReleased(evt);

} public void keyTyped(java.awt.event.KeyEvent evt)


{ jTextField4KeyTyped(evt);

Saket College of arts,science and commerce 40


Hotel management system 226662

Saket College of arts,science and commerce 41


Hotel management system 226662

});

getContentPane().add(jTextField4,neworg.netbeans.lib.awtextra.AbsoluteConstraints(650,
450, 201, -1));

jLabel7.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel7.setForeground(new java.awt.Color(255, 255, 255)); jLabel7.setText("SIGNUP");

getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(660,


170, -1, -1));

jButton1.setBackground(new java.awt.Color(102, 0, 0));

jButton1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jButton1.setForeground(new java.awt.Color(255, 255, 255));

jButton1.setText("Forgot Password"); jButton1.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jButton1ActionPerformed(evt);

});

getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(510,


500, -1, -1));

jButton2.setBackground(new java.awt.Color(102, 0, 0)); jButton2.setFont(new


java.awt.Font("Tahoma", 1, 12)); // NOI18N jButton2.setForeground(new
java.awt.Color(255, 255, 255)); jButton2.setText("signup");

Saket College of arts,science and commerce 42


Hotel management system 226662

Saket College of arts,science and commerce 43


Hotel management system 226662

jButton2.addActionListener(new java.awt.event.ActionListener() { public

void actionPerformed(java.awt.event.ActionEvent evt)

{ jButton2ActionPerformed(evt);

});

getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(670, 500,


-1, -1));

jButton3.setBackground(new java.awt.Color(102, 0, 0));

jButton3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jButton3.setForeground(new java.awt.Color(255, 255, 255));

jButton3.setText("Login"); jButton3.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jButton3ActionPerformed(evt);

});

getContentPane().add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(780,


500, -1, -1));

jButton4.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/close.png"))); // NOI18N

jButton4.addActionListener(new java.awt.event.ActionListener() { public

void actionPerformed(java.awt.event.ActionEvent evt)

{ jButton4ActionPerformed(evt);

Saket College of arts,science and commerce 44


Hotel management system 226662

Saket College of arts,science and commerce 45


Hotel management system 226662

});

getContentPane().add(jButton4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(1330, 10, 30, -1));

elab.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N elab.setForeground(new

java.awt.Color(255, 51, 51));

getContentPane().add(elab, new org.netbeans.lib.awtextra.AbsoluteConstraints(860,


270, 110, 21));

adlab.setForeground(new java.awt.Color(255, 51, 51));

getContentPane().add(adlab, new org.netbeans.lib.awtextra.AbsoluteConstraints(870,


450, 92, 21));

pass.setForeground(new java.awt.Color(255, 51, 51));

getContentPane().add(pass, new org.netbeans.lib.awtextra.AbsoluteConstraints(863,


310, 92, 21));

jLabel8.setForeground(new java.awt.Color(255, 255, 255)); jLabel8.setText("Password

must be atleast 8 characters with special sign");

getContentPane().add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(650,


338, -1, -1));

anslab.setForeground(new java.awt.Color(255, 51, 51));

getContentPane().add(anslab, new org.netbeans.lib.awtextra.AbsoluteConstraints(874,


398, 96, 25));

jLabel9.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/signup.PNG"))); // NOI18N
getContentPane().add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0,

Saket College of arts,science and commerce 46


Hotel management system 226662

Saket College of arts,science and commerce 47


Hotel management system 226662

-1, -1)); pack();

setLocationRelativeTo(null);

}// </editor-fold> private void

jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

setVisible(false); new

ForgotPassword().setVisible(true);

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

String name=jTextField1.getText();

String Email=jTextField2.getText();

String Password=password.getText();

String Securityquestions=(String)jComboBox1.getSelectedItem();

String Answer=jTextField3.getText(); String

Address=jTextField4.getText();

if (name.equals("") || Email.equals("") || Password.equals("") || Answer.equals("") ||


Address.equals(""))

JOptionPane.showMessageDialog(null,"Every field is required");

String PATTERN ="^[a-zA-Z0-9]{8,15}[@#$%&][a-zA-Z0-9]{0,10}$";

Pattern patt=Pattern.compile(PATTERN);

Matcher match=patt.matcher(password.getText()); if(!match.matches())

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

Saket College of arts,science and commerce 48


Hotel management system 226662

Saket College of arts,science and commerce 49


Hotel management system 226662

} if(!(Pattern.matches("^[a-zA-Z0-9]+[@]+gmail+[.]+com$",jTextField2.getText()))){

JOptionPane.showMessageDialog(null,"Invalid Email format");

else

String Query;

Query="insert into user


values('"+name+"','"+Email+"','"+Password+"','"+Securityquestions+"','"+Answer+"','"+Addr
ess+"','false')";

InsertUpdateDelete.setData(Query,"Registered Successfully");

setVisible(false); new signup().setVisible(true);

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

int a=JOptionPane.showConfirmDialog(null, "Do you really want to close


Application","Select",JOptionPane.YES_NO_OPTION); if(a==0)

System.exit(0);

} private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

setVisible(false); new
login().setVisible(true);

Saket College of arts,science and commerce 50


Hotel management system 226662

Saket College of arts,science and commerce 51


Hotel management system 226662

} private void jTextField1KeyTyped(java.awt.event.KeyEvent

evt) {

// TODO add your handling code\ here: char

c=evt.getKeyChar();

if(!(Character.isAlphabetic(c)||(c==KeyEvent.VK_SPACE)||(c==KeyEvent.VK_DELETE)||(c
==KeyEvent.VK_PERIOD)||(c==KeyEvent.VK_AMPERSAND)||(c==KeyEvent.VK_BACK
_SPACE))){

JOptionPane.showMessageDialog(null,"Alphabets only");

getToolkit().beep(); evt.consume();

} private void jTextField2KeyReleased(java.awt.event.KeyEvent evt) {

// TODO add your handling code here: if(!(Pattern.matches("^[a-zA-Z0-9]+[@]+gmail+[.]

+com$",jTextField2.getText()))){ elab.setText("Invalid format");

else{ elab.setText(n

ull);

} private void passwordKeyReleased(java.awt.event.KeyEvent evt) {

// TODO add your handling code here:

String PATTERN ="^[a-zA-Z0-9]{8,15}[@#$%&][a-zA-Z0-9]{0,10}$";

Pattern patt=Pattern.compile(PATTERN);

Matcher match=patt.matcher(password.getText());

Saket College of arts,science and commerce 52


Hotel management system 226662

Saket College of arts,science and commerce 53


Hotel management system 226662

if(!match.matches()){ pass.setText("weak

Password");

} else{ pass.setText("Strong

password");

pass.setForeground(Color.green);

} private void jTextField4KeyTyped(java.awt.event.KeyEvent evt) {

// TODO add your handling code here: char

c=evt.getKeyChar();

if(!(Character.isAlphabetic(c)||(Character.isDigit(c)||(c==KeyEvent.VK_SPACE)||(c==KeyEv
ent.VK_DELETE)||(c==KeyEvent.VK_PERIOD)||(c==KeyEvent.VK_BACK_SPACE)))){

JOptionPane.showMessageDialog(null,"Incorrect Address Format");

getToolkit().beep(); evt.consume();

}}

private void jTextField3KeyTyped(java.awt.event.KeyEvent evt) {

// TODO add your handling code here: char

c=evt.getKeyChar();

if(!(Character.isAlphabetic(c)||(c==KeyEvent.VK_SPACE)||(c==KeyEvent.VK_DELETE)||(c
==KeyEvent.VK_PERIOD)||(c==KeyEvent.VK_BACK_SPACE)||(c==KeyEvent.VK_SHIF
T))){

JOptionPane.showMessageDialog(null,"Incorrect Answer Format");

Saket College of arts,science and commerce 54


Hotel management system 226662

Saket College of arts,science and commerce 55


Hotel management system 226662

getToolkit().beep(); evt.consume();

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName()))

{ javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(signup.class.getName()).log(java.util.logging.Level.SEV ERE,
null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(signup.class.getName()).log(java.util.logging.Level.SEV ERE,
null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(signup.class.getName()).log(java.util.logging.Level.SEV ERE,
null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(signup.class.getName()).log(java.util.logging.Level.SEV ERE,
null, ex);

Saket College of arts,science and commerce 56


Hotel management system 226662

Saket College of arts,science and commerce 57


Hotel management system 226662

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() { new signup().setVisible(true);

});

// Variables declaration - do not modify private


javax.swing.JLabel adlab; private javax.swing.JLabel
anslab; private javax.swing.JLabel elab; private
javax.swing.JButton jButton1; private
javax.swing.JButton jButton2; private
javax.swing.JButton jButton3; private
javax.swing.JButton jButton4; private
javax.swing.JComboBox<String> jComboBox1;
private javax.swing.JLabel jLabel1; private
javax.swing.JLabel jLabel2; private javax.swing.JLabel
jLabel3; private javax.swing.JLabel jLabel4; private
javax.swing.JLabel jLabel5; private javax.swing.JLabel
jLabel6;

Saket College of arts,science and commerce 58


Hotel management system 226662

Saket College of arts,science and commerce 59


Hotel management system 226662

private javax.swing.JLabel jLabel7; private

javax.swing.JLabel jLabel8; private

javax.swing.JLabel jLabel9; private

javax.swing.JTextField jTextField1; private

javax.swing.JTextField jTextField2; private

javax.swing.JTextField jTextField3; private

javax.swing.JTextField jTextField4; private

javax.swing.JLabel pass; private

javax.swing.JPasswordField password;

// End of variables declaration

Login.java: import

javax.swing.JOptionPane; import

java.sql.*; import Project.Select;

import co.yogesh.Captcha; import

javax.swing.JLabel; import

java.util.regex.*; Captcha cap=new

Captcha(); public login()

{ initComponents();

cap.setImageCaptcha(captcha);

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

Saket College of arts,science and commerce 60


Hotel management system 226662

Saket College of arts,science and commerce 61


Hotel management system 226662

private void initComponents() {

jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel(); jTextField1 = new

javax.swing.JTextField(); jButton4 = new javax.swing.JButton(); jButton1 =

new javax.swing.JButton(); jButton2 = new javax.swing.JButton();

jPasswordField1 = new javax.swing.JPasswordField(); jButton3 = new

javax.swing.JButton(); captcha = new javax.swing.JLabel(); jButton5 = new

javax.swing.JButton(); Verify = new javax.swing.JTextField(); jLabel5 = new

javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setUndecorated(true); getContentPane().setLayout(new

org.netbeans.lib.awtextra.AbsoluteLayout()); jLabel1.setFont(new

java.awt.Font("Tahoma", 1, 18)); // NOI18N jLabel1.setForeground(new

java.awt.Color(255, 255, 255)); jLabel1.setText("LOGIN");

getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(640,


290, -1, -1)); jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); //
NOI18N jLabel2.setForeground(new java.awt.Color(255, 255,
255));

Saket College of arts,science and commerce 62


Hotel management system 226662

Saket College of arts,science and commerce 63


Hotel management system 226662

jLabel2.setText("Email");

getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(460,


340, -1, -1)); jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); //

NOI18N jLabel3.setForeground(new java.awt.Color(255, 255,

255)); jLabel3.setText("Password");

getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(460,


380, -1, -1)); jTextField1.setFont(new java.awt.Font("Tahoma", 1, 12)); //

NOI18N jTextField1.addKeyListener(new

java.awt.event.KeyAdapter() { public void

keyReleased(java.awt.event.KeyEvent evt)

{ jTextField1KeyReleased(evt);

});

getContentPane().add(jTextField1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(580, 340, 318, -1));

jButton4.setBackground(new java.awt.Color(120, 0, 0));

jButton4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jButton4.setForeground(new java.awt.Color(255, 255, 255));

jButton4.setText("Login"); jButton4.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jButton4ActionPerformed(evt);

});

getContentPane().add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(530,


470, -1, -1));

Saket College of arts,science and commerce 64


Hotel management system 226662

Saket College of arts,science and commerce 65


Hotel management system 226662

jButton1.setBackground(new java.awt.Color(120, 0, 0));

jButton1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jButton1.setForeground(new java.awt.Color(255, 255, 255));

jButton1.setText("Signup"); jButton1.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jButton1ActionPerformed(evt);

});

getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(620,


470, -1, -1)); jButton2.setBackground(new java.awt.Color(120, 0, 0));

jButton2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jButton2.setForeground(new java.awt.Color(255, 255, 255));

jButton2.setText("Forgot Password");

jButton2.addActionListener(new java.awt.event.ActionListener()

{ public void actionPerformed(java.awt.event.ActionEvent evt)

{ jButton2ActionPerformed(evt);

});

getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(720,


470, -1, -1));

getContentPane().add(jPasswordField1,org.netbeans.lib.awtextra.AbsoluteConstraints(580,
380, 320, -1));

jButton3.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/close.png"))); // NOI18N

Saket College of arts,science and commerce 66


Hotel management system 226662

Saket College of arts,science and commerce 67


Hotel management system 226662

jButton3.addActionListener(new java.awt.event.ActionListener() { public

void actionPerformed(java.awt.event.ActionEvent evt)

{ jButton3ActionPerformed(evt);

});

getContentPane().add(jButton3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(1320, 0, 40, -1));

getContentPane().add(captcha, new org.netbeans.lib.awtextra.AbsoluteConstraints(580,


420, 140, 40));

jButton5.setBackground(new java.awt.Color(102, 0, 0));

jButton5.setForeground(new java.awt.Color(255, 255, 255));

jButton5.setText("Verify"); jButton5.addMouseListener(new

java.awt.event.MouseAdapter() { public void

mouseClicked(java.awt.event.MouseEvent evt)

{ jButton5MouseClicked(evt);

});

getContentPane().add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(840,


420, -1, -1));

Verify.addActionListener(new java.awt.event.ActionListener() { public

void actionPerformed(java.awt.event.ActionEvent evt)

{ VerifyActionPerformed(evt);

}); getContentPane().add(Verify, new


org.netbeans.lib.awtextra.AbsoluteConstraints(740,

Saket College of arts,science and commerce 68


Hotel management system 226662

Saket College of arts,science and commerce 69


Hotel management system 226662

420, 90, -1));

jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jLabel5.setForeground(new java.awt.Color(255, 255, 255)); jLabel5.setText("Enter

Captcha");

getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(460,


420, 110, -1));

jLabel4.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/login.PNG"))); // NOI18N

getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0,


-1, -1));

pack(); setLocationRelativeTo(null);

}// </editor-fold> private void

jButton3ActionPerformed(java.awt.event.ActionEvent evt) { // TODO

add your handling code here:

int a=JOptionPane.showConfirmDialog(null, "Do you really want to close


Application","Select",JOptionPane.YES_NO_OPTION); if(a==0)

System.exit(0);

} private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here: int

check=0;

String Email=jTextField1.getText();

Saket College of arts,science and commerce 70


Hotel management system 226662

Saket College of arts,science and commerce 71


Hotel management system 226662

String Password=jPasswordField1.getText(); String

Enter=Verify.getText(); if(Email.equals("") ||

Password.equals("")||(Enter.equals("")))

{ check=1;

JOptionPane.showMessageDialog(null,"Every Field is required");

else if(!(cap.Validate(captcha,Verify.getText())))

{ check=1;

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

else if(Email.equals("Saurabhpandey@gmail.com") &&


Password.equals("8369289736"))

{ check=1; setVisible(false); new

adminHome().setVisible(true);

else

ResultSet rs=Select.getData("select * from user where Email='"+Email+"' and


Password='"+Password+"'");

try

{ if(rs.next())

Saket College of arts,science and commerce 72


Hotel management system 226662

Saket College of arts,science and commerce 73


Hotel management system 226662

{ check=1;

if(rs.getString(7).equals("true"))

{ setVisible(false); new

home().setVisible(true);

else

JOptionPane.showMessageDialog(null,"wait for admin Approval");

}}

catch(Exception

e)

JOptionPane.showMessageDialog(null,e);

} if(check==0)

JOptionPane.showMessageDialog(null,"Incorrect Email or Password");

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

setVisible(false); new

signup().setVisible(true);

Saket College of arts,science and commerce 74


Hotel management system 226662

Saket College of arts,science and commerce 75


Hotel management system 226662

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

setVisible(false); new

ForgotPassword().setVisible(true);

private void jButton5MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

if(cap.Validate(captcha,Verify.getText()))

JOptionPane.showMessageDialog(this,"correct captcha");

else

JOptionPane.showMessageDialog(this,"Incorreect captcha");

private void VerifyActionPerformed(java.awt.event.ActionEvent evt) { //

TODO add your handling code here:

} try

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName()))
{ javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;

Saket College of arts,science and commerce 76


Hotel management system 226662

Saket College of arts,science and commerce 77


Hotel management system 226662

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVE RE,
null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(login.class.getName()).log(java.util.logging.Level.SEVE RE,
null, ex);

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() { new login().setVisible(true);

});

// Variables declaration - do not modify private


javax.swing.JTextField Verify;

Saket College of arts,science and commerce 78


Hotel management system 226662

Saket College of arts,science and commerce 79


Hotel management system 226662

private javax.swing.JLabel captcha; private

javax.swing.JButton jButton1; private

javax.swing.JButton jButton2; private

javax.swing.JButton jButton3; private

javax.swing.JButton jButton4; private

javax.swing.JButton jButton5; private

javax.swing.JLabel jLabel1; private

javax.swing.JLabel jLabel2; private

javax.swing.JLabel jLabel3; private

javax.swing.JLabel jLabel4; private

javax.swing.JLabel jLabel5; private

javax.swing.JPasswordField jPasswordField1; private

javax.swing.JTextField jTextField1;

// End of variables declaration

ForgotPassword.java:

import java.sql.*; import

Project.*; import java.awt.Color;

import java.util.regex.Pattern;

import

javax.swing.JOptionPane;

public class ForgotPassword extends javax.swing.JFrame {

public ForgotPassword() {

Saket College of arts,science and commerce 80


Hotel management system 226662

Saket College of arts,science and commerce 81


Hotel management system 226662

initComponents();

String Email;

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jLabel1 = new javax.swing.JLabel(); jLabel2 =


new javax.swing.JLabel(); jLabel3 = new
javax.swing.JLabel(); jLabel4 = new
javax.swing.JLabel(); jLabel5 = new
javax.swing.JLabel(); jTextField1 = new
javax.swing.JTextField(); jTextField3 = new
javax.swing.JTextField(); jButton2 = new
javax.swing.JButton(); jButton3 = new
javax.swing.JButton(); jButton4 = new
javax.swing.JButton(); jButton5 = new
javax.swing.JButton(); jButton6 = new
javax.swing.JButton(); jTextField2 = new
javax.swing.JTextField(); password = new
javax.swing.JPasswordField(); jLabel6 = new
javax.swing.JLabel(); pass = new
javax.swing.JLabel(); anslab = new
javax.swing.JLabel();

Saket College of arts,science and commerce 82


Hotel management system 226662

Saket College of arts,science and commerce 83


Hotel management system 226662

jLabel7 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setUndecorated(true); getContentPane().setLayout(new

org.netbeans.lib.awtextra.AbsoluteLayout());

jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N

jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setText("FORGOT

PASSWORD");

getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(600,


200, -1, 25));

jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jLabel2.setForeground(new java.awt.Color(255, 255, 255)); jLabel2.setText("Email");

getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(410,


280, -1, -1));

jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jLabel3.setForeground(new java.awt.Color(255, 255, 255)); jLabel3.setText("Security

questions");

getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(410,


320, -1, -1));

jLabel4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N


jLabel4.setForeground(new java.awt.Color(255, 255, 255)); jLabel4.setText("Answer");

Saket College of arts,science and commerce 84


Hotel management system 226662

Saket College of arts,science and commerce 85


Hotel management system 226662

getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(410,


360, -1, -1));

jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jLabel5.setForeground(new java.awt.Color(255, 255, 255)); jLabel5.setText("New

password");

getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(410,


400, -1, -1));

jTextField1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jTextField1.addActionListener(new java.awt.event.ActionListener()

{ public void actionPerformed(java.awt.event.ActionEvent evt)

{ jTextField1ActionPerformed(evt);

});

getContentPane().add(jTextField1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(550, 280, 297, -1));

jTextField3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jTextField3.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyReleased(java.awt.event.KeyEvent evt)

{ jTextField3KeyReleased(evt);

});

getContentPane().add(jTextField3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(550, 360, 300, -1));

Saket College of arts,science and commerce 86


Hotel management system 226662

Saket College of arts,science and commerce 87


Hotel management system 226662

jButton2.setBackground(new java.awt.Color(120, 0, 0));

jButton2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jButton2.setForeground(new java.awt.Color(255, 255, 255));

jButton2.setText("Save"); jButton2.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jButton2ActionPerformed(evt);

});

getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(550,


460, 77, -1));

jButton3.setBackground(new java.awt.Color(120, 0, 0));

jButton3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jButton3.setForeground(new java.awt.Color(255, 255, 255));

jButton3.setText("Signup"); jButton3.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jButton3ActionPerformed(evt);

});

getContentPane().add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(660,


460, -1, -1));

jButton4.setBackground(new java.awt.Color(120, 0, 0)); jButton4.setFont(new


java.awt.Font("Tahoma", 1, 12)); // NOI18N

Saket College of arts,science and commerce 88


Hotel management system 226662

Saket College of arts,science and commerce 89


Hotel management system 226662

jButton4.setForeground(new java.awt.Color(255, 255, 255));

jButton4.setText("Login"); jButton4.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jButton4ActionPerformed(evt);

});

getContentPane().add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(770,


460, -1, -1));

jButton5.setBackground(new java.awt.Color(120, 0, 0));

jButton5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jButton5.setForeground(new java.awt.Color(255, 255, 255));

jButton5.setText("Search"); jButton5.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jButton5ActionPerformed(evt);

});

getContentPane().add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(870,


280, -1, -1));

jButton6.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/close.png"))); // NOI18N
jButton6.addActionListener(new java.awt.event.ActionListener() { public
void actionPerformed(java.awt.event.ActionEvent evt)
{ jButton6ActionPerformed(evt);

Saket College of arts,science and commerce 90


Hotel management system 226662

Saket College of arts,science and commerce 91


Hotel management system 226662

});

getContentPane().add(jButton6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(1330, 0, 30, 30));

jTextField2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

jTextField2.addActionListener(new java.awt.event.ActionListener() { public

void actionPerformed(java.awt.event.ActionEvent evt)

{ jTextField2ActionPerformed(evt);

});

getContentPane().add(jTextField2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(550, 320, 300, -1));

password.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

password.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyReleased(java.awt.event.KeyEvent evt)

{ passwordKeyReleased(evt);

});

getContentPane().add(password, new
org.netbeans.lib.awtextra.AbsoluteConstraints(550, 400, 300, -1));

jLabel6.setForeground(new java.awt.Color(255, 255, 255)); jLabel6.setText("Password

must be at least 8 characters long with one special sign");

getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(550,


430, -1, -1));

Saket College of arts,science and commerce 92


Hotel management system 226662

Saket College of arts,science and commerce 93


Hotel management system 226662

pass.setForeground(new java.awt.Color(255, 51, 51));

getContentPane().add(pass, new org.netbeans.lib.awtextra.AbsoluteConstraints(860,


400, 128, 26));

anslab.setForeground(new java.awt.Color(255, 51, 51));

getContentPane().add(anslab, new org.netbeans.lib.awtextra.AbsoluteConstraints(860,


360, 130, 21));

jLabel7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/forgot
password.PNG"))); // NOI18N

getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0,


1360, -1));

pack(); setLocationRelativeTo(null);

}// </editor-fold>

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

int a=JOptionPane.showConfirmDialog(null, "Do you really want to close


Application","Select",JOptionPane.YES_NO_OPTION); if(a==0)

System.exit(0);

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

Saket College of arts,science and commerce 94


Hotel management system 226662

Saket College of arts,science and commerce 95


Hotel management system 226662

int check=0;

Email=jTextField1.getText(); if(Email.equals(""))

{ check=1;

JOptionPane.showMessageDialog(null,"Email Field is required");

else

ResultSet rs = Select.getData("Select *from user where email='"+Email+"'"); try

{ if(rs.next())

{ check=1;

jTextField2.setEditable(false);

jTextField1.setEditable(false);

jTextField2.setText(rs.getString(4));

}}

catch(Exception

e)

JOptionPane.showMessageDialog(null,e);

} if(check==0)

Saket College of arts,science and commerce 96


Hotel management system 226662

Saket College of arts,science and commerce 97


Hotel management system 226662

JOptionPane.showMessageDialog(null,"Incorrect Email");

}}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here: int

check=0;

String Securityquestions=jTextField2.getText();

String Answer=jTextField3.getText(); String

Newpassword=password.getText();

if(Answer.equals("") || Newpassword.equals(" "))

{ check=1;

JOptionPane.showMessageDialog(null,"All field is required");

if(!(Pattern.matches("^[a-zA-Z0-9]{8,15}[@#%&*][a-zA-Z0- 9]
{0,10}$",password.getText())))

JOptionPane.showMessageDialog(null,"Invalid password format");

else

ResultSet rs=Select.getData("Select *from user where Email='"+Email+"' and


Securityquestions='"+Securityquestions+"' and Answer='"+Answer+"'");

try {

Saket College of arts,science and commerce 98


Hotel management system 226662

Saket College of arts,science and commerce 99


Hotel management system 226662

if(rs.next())

{ check=1;

InsertUpdateDelete.setData("update user set


Password='"+Newpassword+"'where Email='"+Email+"'","Password set successfully");

setVisible(false); new

ForgotPassword().setVisible(true);

}}

catch(Exception e)

JOptionPane.showMessageDialog(null,e);

} if(check==0)

JOptionPane.showMessageDialog(null,"Incorrect Answer");

}}

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

setVisible(false); new

signup().setVisible(true);

Saket College of arts,science and commerce 100


Hotel management system 226662

Saket College of arts,science and commerce 101


Hotel management system 226662

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

setVisible(false); new

login().setVisible(true);

private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) { //

TODO add your handling code here:

private void passwordKeyReleased(java.awt.event.KeyEvent evt) { //

TODO add your handling code here:

if(!(Pattern.matches("^[a-zA-Z0-9]{8,15}[@#%&*][a-zA-Z0- 9]
{0,10}$",password.getText())))

{ pass.setText("Weak passsword");

pass.setForeground(Color.red);

} else{ pass.setText("Strong

password");

pass.setForeground(Color.green);

Saket College of arts,science and commerce 102


Hotel management system 226662

Saket College of arts,science and commerce 103


Hotel management system 226662

private void jTextField3KeyReleased(java.awt.event.KeyEvent evt) { //

TODO add your handling code here:

if(!(Pattern.matches("^[a-zA-Z]{0,20}$",jTextField3.getText())))

{ anslab.setText("Incorrect Answer");

else{ anslab.setText(n

ull);

}}

private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) { //

TODO add your handling code here:

public static void main(String args[]) { try

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName()))

{ javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

Saket College of arts,science and commerce 104


Hotel management system 226662

Saket College of arts,science and commerce 105


Hotel management system 226662

java.util.logging.Logger.getLogger(ForgotPassword.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(ForgotPassword.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(ForgotPassword.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(ForgotPassword.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);

//</editor-fold>

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() { new

ForgotPassword().setVisible(true);

});

// Variables declaration - do not modify


private javax.swing.JLabel anslab;
private javax.swing.JButton jButton2;

Saket College of arts,science and commerce 106


Hotel management system 226662

Saket College of arts,science and commerce 107


Hotel management system 226662

private javax.swing.JButton jButton3; private

javax.swing.JButton jButton4; private

javax.swing.JButton jButton5; private

javax.swing.JButton jButton6; private

javax.swing.JLabel jLabel1; private

javax.swing.JLabel jLabel2; private

javax.swing.JLabel jLabel3; private

javax.swing.JLabel jLabel4; private

javax.swing.JLabel jLabel5; private

javax.swing.JLabel jLabel6; private

javax.swing.JLabel jLabel7; private

javax.swing.JTextField jTextField1; private

javax.swing.JTextField jTextField2; private

javax.swing.JTextField jTextField3; private

javax.swing.JLabel pass; private

javax.swing.JPasswordField password;

// End of variables declaration

Home.java:

import javax.swing.JOptionPane; public class

home extends javax.swing.JFrame {

public home() { initComponents();

Saket College of arts,science and commerce 108


Hotel management system 226662

Saket College of arts,science and commerce 109


Hotel management system 226662

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() { jButton1 =new

javax.swing.JButton(); jButton2 = new javax.swing.JButton();

jButton3 = new javax.swing.JButton(); jButton4 = new

javax.swing.JButton(); jButton5 = new javax.swing.JButton();

jButton6 = new javax.swing.JButton(); jLabel1 = new

javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setUndecorated(true); getContentPane().setLayout(new

org.netbeans.lib.awtextra.AbsoluteLayout());

jButton1.setBackground(new java.awt.Color(255, 255, 255)); jButton1.setFont(new

java.awt.Font("Algerian", 1, 14)); // NOI18N jButton1.setForeground(new

java.awt.Color(102, 0, 0));

jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/manage
room.png"))); // NOI18N jButton1.setText("MANAGE ROOM");

jButton1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt)

{ jButton1ActionPerformed(evt);

});

Saket College of arts,science and commerce 110


Hotel management system 226662

Saket College of arts,science and commerce 111


Hotel management system 226662

getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(12,


13, -1, -1));

jButton2.setBackground(new java.awt.Color(255, 255, 255)); jButton2.setFont(new

java.awt.Font("Algerian", 1, 14)); // NOI18N jButton2.setForeground(new

java.awt.Color(102, 0, 0));

jButton2.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/Customer Registration & Check
IN.png"))); // NOI18N jButton2.setText("CUSTOMER CHECK IN");

jButton2.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt)

{ jButton2ActionPerformed(evt);

});

getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(227,


13, -1, -1));

jButton3.setBackground(new java.awt.Color(255, 255, 255)); jButton3.setFont(new

java.awt.Font("Algerian", 1, 14)); // NOI18N jButton3.setForeground(new

java.awt.Color(102, 0, 0));

jButton3.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/Customer Check Out.png"))); //
NOI18N jButton3.setText("CUSTOMER CHECK OUT");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt)
{ jButton3ActionPerformed(evt);

Saket College of arts,science and commerce 112


Hotel management system 226662

Saket College of arts,science and commerce 113


Hotel management system 226662

});

getContentPane().add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(482,


13, -1, -1));

jButton4.setBackground(new java.awt.Color(255, 255, 255)); jButton4.setFont(new

java.awt.Font("Algerian", 1, 14)); // NOI18N jButton4.setForeground(new

java.awt.Color(102, 0, 0));

jButton4.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/Customer Details Bill.png"))); //
NOI18N jButton4.setText("CUSTOMER DETAIL BILLS");

jButton4.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt)

{ jButton4ActionPerformed(evt);

});

getContentPane().add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(751,


13, -1, -1));

jButton5.setBackground(new java.awt.Color(255, 255, 255)); jButton5.setFont(new

java.awt.Font("Algerian", 1, 14)); // NOI18N jButton5.setForeground(new

java.awt.Color(102, 0, 0));

jButton5.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/logout.png"))); // NOI18N
jButton5.setText("LOGOUT"); jButton5.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) {

Saket College of arts,science and commerce 114


Hotel management system 226662

Saket College of arts,science and commerce 115


Hotel management system 226662

jButton5ActionPerformed(evt);

});

getContentPane().add(jButton5, new org.netbeans.lib.awtextra.AbsoluteConstraints(1040,


13, -1, -1));

jButton6.setBackground(new java.awt.Color(255, 255, 255)); jButton6.setFont(new

java.awt.Font("Algerian", 1, 14)); // NOI18N jButton6.setForeground(new

java.awt.Color(102, 0, 0));

jButton6.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/exit.png"))); // NOI18N

jButton6.setText("EXIT"); jButton6.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jButton6ActionPerformed(evt);

});

getContentPane().add(jButton6, new org.netbeans.lib.awtextra.AbsoluteConstraints(1203,


13, -1, -1));

jLabel1.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/home.png"))); // NOI18N

jLabel1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0,


-1, -1));

pack(); setLocationRelativeTo(null);

Saket College of arts,science and commerce 116


Hotel management system 226662

Saket College of arts,science and commerce 117


Hotel management system 226662

}// </editor-fold>

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

int a=JOptionPane.showConfirmDialog(null,"Do you really want to


logout","Select",JOptionPane.YES_NO_OPTION); if(a==0)

{ setVisible(false); new

login().setVisible(true);

}}

private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

int a=JOptionPane.showConfirmDialog(null,"Do you really want to close


application","Select",JOptionPane.YES_NO_OPTION); if(a==0)

System.exit(0);

} private void

jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here: new

Manageroom().setVisible(true);

} private void jButton2ActionPerformed(java.awt.event.ActionEvent evt)


{

Saket College of arts,science and commerce 118


Hotel management system 226662

Saket College of arts,science and commerce 119


Hotel management system 226662

// TODO add your handling code here: new

CustomerCheckIn().setVisible(true);

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

new CustomerCheckOut().setVisible(true);

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

new CustomerDetailBill().setVisible(true);

} public static void main(String args[])

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> try

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName()))

{ javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

Saket College of arts,science and commerce 120


Hotel management system 226662

Saket College of arts,science and commerce 121


Hotel management system 226662

java.util.logging.Logger.getLogger(home.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(home.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(home.class.getName()).log(java.util.logging.Level.SEVE RE,
null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(home.class.getName()).log(java.util.logging.Level.SEVE RE,
null, ex);

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() { new home().setVisible(true);

});

// Variables declaration - do not modify


private javax.swing.JButton jButton1; private
javax.swing.JButton jButton2; private
javax.swing.JButton jButton3;

Saket College of arts,science and commerce 122


Hotel management system 226662

Saket College of arts,science and commerce 123


Hotel management system 226662

private javax.swing.JButton jButton4; private

javax.swing.JButton jButton5; private

javax.swing.JButton jButton6; private

javax.swing.JLabel jLabel1;

// End of variables declaration

Manageroom.java:

import Project.InsertUpdateDelete; import

Project.Select; import

com.sun.glass.events.KeyEvent; import

project.*; import java.sql.*; import

java.util.regex.Pattern; import

javax.swing.JOptionPane; import

javax.swing.table.DefaultTableModel; /*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

/**

* @author Lenovo

*/

Saket College of arts,science and commerce 124


Hotel management system 226662

Saket College of arts,science and commerce 125


Hotel management system 226662

public class Manageroom extends javax.swing.JFrame {

/**

* Creates new form Manageroom

*/

public Manageroom() { initComponents();

/**

* This method is called from within the constructor to initialize the form. *

WARNING: Do NOT modify this code. The content of this method is always *

regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code"> private

void initComponents() {

jLabel1 = new javax.swing.JLabel(); jButton1


= new javax.swing.JButton(); jScrollPane1 =
new javax.swing.JScrollPane(); jTable1 = new
javax.swing.JTable(); jLabel2 = new
javax.swing.JLabel(); jTextField1 = new
javax.swing.JTextField(); jLabel3 = new
javax.swing.JLabel();

Saket College of arts,science and commerce 126


Hotel management system 226662

Saket College of arts,science and commerce 127


Hotel management system 226662

jComboBox1 = new javax.swing.JComboBox<>();

jLabel4 = new javax.swing.JLabel(); jComboBox2

= new javax.swing.JComboBox<>(); jLabel5 =

new javax.swing.JLabel(); jTextField2 = new

javax.swing.JTextField(); jButton2 = new

javax.swing.JButton(); room = new

javax.swing.JLabel(); price = new

javax.swing.JLabel(); jLabel6 = new

javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setLocation(new java.awt.Point(50, 118)); setUndecorated(true);

addComponentListener(new java.awt.event.ComponentAdapter() { public void

componentShown(java.awt.event.ComponentEvent evt)

{ formComponentShown(evt);

}); getContentPane().setLayout(new

org.netbeans.lib.awtextra.AbsoluteLayout());

jLabel1.setBackground(new java.awt.Color(255, 255, 255));

jLabel1.setFont(new java.awt.Font("Algerian", 1, 18)); // NOI18N

jLabel1.setForeground(new java.awt.Color(102, 0, 0));

jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/manage
room.png"))); // NOI18N jLabel1.setText("MANAGE
ROOM");

Saket College of arts,science and commerce 128


Hotel management system 226662

Saket College of arts,science and commerce 129


Hotel management system 226662

getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(83,


13, -1, -1));

jButton1.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/close.png"))); // NOI18N

jButton1.addActionListener(new java.awt.event.ActionListener() { public

void actionPerformed(java.awt.event.ActionEvent evt)

{ jButton1ActionPerformed(evt);

});

getContentPane().add(jButton1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(1230, 10, 31, -1));

jTable1.setModel(new javax.swing.table.DefaultTableModel( new

Object [][] {

}, new String

[] {

"Room Number", "Room Type", "Bed", "Price", "Status"

));

jScrollPane1.setViewportView(jTable1);

getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(83, 81, 598, -1));

jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

Saket College of arts,science and commerce 130


Hotel management system 226662

Saket College of arts,science and commerce 131


Hotel management system 226662

jLabel2.setText("Room Number");

getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(800,


80, -1, -1));

jTextField1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jTextField1.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyReleased(java.awt.event.KeyEvent evt)

{ jTextField1KeyReleased(evt);

} public void keyTyped(java.awt.event.KeyEvent evt)

{ jTextField1KeyTyped(evt);

});

getContentPane().add(jTextField1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(800, 110, 465, -1));

jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel3.setText("Room

Type");

getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(800,


170, -1, -1));

jComboBox1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] {


"AC", "NON-AC" }));

getContentPane().add(jComboBox1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(800, 200, 465, -1));

jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

Saket College of arts,science and commerce 132


Hotel management system 226662

Saket College of arts,science and commerce 133


Hotel management system 226662

jLabel4.setText("Bed");

getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(800,


250, -1, -1));

jComboBox2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] {


"Single", "Double", "Triple" }));

getContentPane().add(jComboBox2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(800, 280, 465, -1));

jLabel5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel5.setText("Price");

getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(800,


330, -1, -1));

jTextField2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jTextField2.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyReleased(java.awt.event.KeyEvent evt)

{ jTextField2KeyReleased(evt);

} public void keyTyped(java.awt.event.KeyEvent evt)

{ jTextField2KeyTyped(evt);

});

getContentPane().add(jTextField2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(800, 360, 460, -1));

jButton2.setBackground(new java.awt.Color(102, 0, 0));

Saket College of arts,science and commerce 134


Hotel management system 226662

Saket College of arts,science and commerce 135


Hotel management system 226662

jButton2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton2.setForeground(new java.awt.Color(255, 255, 255));

jButton2.setText("Add Room"); jButton2.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jButton2ActionPerformed(evt);

});

getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(800,


430, -1, -1));

room.setForeground(new java.awt.Color(255, 51, 51));

getContentPane().add(room, new org.netbeans.lib.awtextra.AbsoluteConstraints(800,


140, 201, 20));

price.setForeground(new java.awt.Color(255, 51, 51));

getContentPane().add(price, new org.netbeans.lib.awtextra.AbsoluteConstraints(800,


390, 128, 18));

jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/all pages


background.png"))); // NOI18N jLabel6.setToolTipText("");

getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -


1, -1));

pack(); setLocationRelativeTo(null);

}// </editor-fold>

Saket College of arts,science and commerce 136


Hotel management system 226662

Saket College of arts,science and commerce 137


Hotel management system 226662

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

setVisible(false);

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

String roomNo=jTextField1.getText();

String roomType=(String)jComboBox1.getSelectedItem();

String bed=(String)jComboBox2.getSelectedItem();

String price=jTextField2.getText();

String Query="insert into room

values('"+roomNo+"','"+roomType+"','"+bed+"','"+price+"','Not Booked')";

InsertUpdateDelete.setData(Query,"Successfully updated");

setVisible(false); new Manageroom().setVisible(true);

private void formComponentShown(java.awt.event.ComponentEvent evt) {

// TODO add your handling code here:

ResultSet rs=Select.getData("select *from room");

DefaultTableModel model=(DefaultTableModel)jTable1.getModel();

try

Saket College of arts,science and commerce 138


Hotel management system 226662

Saket College of arts,science and commerce 139


Hotel management system 226662

{ while(rs.next())

model.addRow(new
Object[]{rs.getString(1),rs.getString(2),rs.getString(3),rs.getString(4),rs.getString(5)});

} rs.close();

} catch(Exception

e)

JOptionPane.showMessageDialog(null,e);

}}

private void jTextField1KeyReleased(java.awt.event.KeyEvent evt) {

// TODO add your handling code here:

if(!(Pattern.matches("^[0-9]{0,4}$",jTextField1.getText())))

{ room.setText("Incorrect Room number");

else{ room.setText(n

ull);

Saket College of arts,science and commerce 140


Hotel management system 226662

Saket College of arts,science and commerce 141


Hotel management system 226662

private void jTextField2KeyReleased(java.awt.event.KeyEvent evt) {

// TODO add your handling code here:

if(!(Pattern.matches("^[0-9]{0,9}$",jTextField2.getText())))

{ price.setText("Incorrect Price");

else{ price.setText(n

ull);

}}

private void jTextField1KeyTyped(java.awt.event.KeyEvent evt) {

// TODO add your handling code here: char

c=evt.getKeyChar();

if(!(Character.isDigit(c)||(c==KeyEvent.VK_SPACE)||(c==KeyEvent.VK_DELETE)||(c==Ke
yEvent.VK_PERIOD)||(c==KeyEvent.VK_BACKSPACE)||(c==KeyEvent.VK_SHIFT))){

JOptionPane.showMessageDialog(null,"Incorrect Room Number");

getToolkit().beep(); evt.consume();

}}

private void jTextField2KeyTyped(java.awt.event.KeyEvent evt) {

// TODO add your handling code here:

Saket College of arts,science and commerce 142


Hotel management system 226662

Saket College of arts,science and commerce 143


Hotel management system 226662

char c=evt.getKeyChar();

if(!(Character.isDigit(c)||(c==KeyEvent.VK_DELETE)||(c==KeyEvent.VK_PERIOD)||(c==K
eyEvent.VK_BACKSPACE))){

JOptionPane.showMessageDialog(null,"Incorrect Price");

getToolkit().beep(); evt.consume();

/**

* @param args the command line arguments

*/ public static void main(String

args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and
feel.

* For details see


http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/ try

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName()))

{ javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

Saket College of arts,science and commerce 144


Hotel management system 226662

Saket College of arts,science and commerce 145


Hotel management system 226662

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(Manageroom.class.getName()).log(java.util.logging.Leve
l.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Manageroom.class.getName()).log(java.util.logging.Leve
l.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(Manageroom.class.getName()).log(java.util.logging.Leve
l.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Manageroom.class.getName()).log(java.util.logging.Leve
l.SEVERE, null, ex);

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() { new

Manageroom().setVisible(true);

});

// Variables declaration - do not modify

Saket College of arts,science and commerce 146


Hotel management system 226662

Saket College of arts,science and commerce 147


Hotel management system 226662

private javax.swing.JButton jButton1; private

javax.swing.JButton jButton2; private

javax.swing.JComboBox<String> jComboBox1; private

javax.swing.JComboBox<String> jComboBox2; private

javax.swing.JLabel jLabel1; private javax.swing.JLabel

jLabel2; private javax.swing.JLabel jLabel3; private

javax.swing.JLabel jLabel4; private javax.swing.JLabel

jLabel5; private javax.swing.JLabel jLabel6; private

javax.swing.JScrollPane jScrollPane1; private

javax.swing.JTable jTable1; private

javax.swing.JTextField jTextField1; private

javax.swing.JTextField jTextField2; private

javax.swing.JLabel price; private javax.swing.JLabel

room;

// End of variables declaration

Customercheckin.java:

import Project.InsertUpdateDelete;
import Project.Select; import
com.sun.glass.events.KeyEvent; import
java.text.SimpleDateFormat; import
java.util.Calendar; import java.sql.*;

Saket College of arts,science and commerce 148


Hotel management system 226662

Saket College of arts,science and commerce 149


Hotel management system 226662

import java.util.regex.Pattern; import

javax.swing.JOptionPane; import

project.*;

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

/**

* @author Lenovo

*/ public class CustomerCheckIn extends

javax.swing.JFrame {

/**

* Creates new form CustomerCheckIn

*/ public CustomerCheckIn()

{ initComponents();

jTextField7.setEditable(false);

jTextField8.setEditable(false);

SimpleDateFormat myFormat=new SimpleDateFormat("yyyy/MM/dd");

Calendar cal=Calendar.getInstance();

Saket College of arts,science and commerce 150


Hotel management system 226662

Saket College of arts,science and commerce 151


Hotel management system 226662

jTextField7.setText(myFormat.format(cal.getTime()));

String bed;

String roomType;

String roomNo; String

Price;

public void roomDetails()

{ jComboBox4.removeAllItems();

jTextField8.setText("");

bed=(String)jComboBox2.getSelectedItem();

roomType=(String)jComboBox3.getSelectedItem();

try

ResultSet rs=Select.getData("select *from room where bed='"+bed+"'and


roomType='"+roomType+"' and status='Not Booked'");

while(rs.next())

{ jComboBox4.addItem(rs.getString(1));

}}

catch(Exception

e)

JOptionPane.showMessageDialog(null,e);

Saket College of arts,science and commerce 152


Hotel management system 226662

Saket College of arts,science and commerce 153


Hotel management system 226662

/**

* This method is called from within the constructor to initialize the form. *

WARNING: Do NOT modify this code. The content of this method is always

* regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code"> private

void initComponents() {

jLabel1 = new javax.swing.JLabel(); jLabel2 =


new javax.swing.JLabel(); jTextField1 = new
javax.swing.JTextField(); jLabel3 = new
javax.swing.JLabel(); jTextField2 = new
javax.swing.JTextField(); jLabel4 = new
javax.swing.JLabel(); jTextField3 = new
javax.swing.JTextField(); jLabel5 = new
javax.swing.JLabel(); jLabel6 = new
javax.swing.JLabel(); jTextField5 = new
javax.swing.JTextField(); jComboBox1 = new
javax.swing.JComboBox<>();

Saket College of arts,science and commerce 154


Hotel management system 226662

Saket College of arts,science and commerce 155


Hotel management system 226662

jLabel7 = new javax.swing.JLabel(); jTextField4 =

new javax.swing.JTextField(); jLabel8 = new

javax.swing.JLabel(); jTextField6 = new

javax.swing.JTextField(); jLabel9 = new

javax.swing.JLabel(); jTextField7 = new

javax.swing.JTextField(); jLabel10 = new

javax.swing.JLabel(); jComboBox2 = new

javax.swing.JComboBox<>(); jLabel11 = new

javax.swing.JLabel(); jComboBox3 = new

javax.swing.JComboBox<>(); jLabel12 = new

javax.swing.JLabel(); jComboBox4 = new

javax.swing.JComboBox<>(); jLabel13 = new

javax.swing.JLabel(); jTextField8 = new

javax.swing.JTextField(); jButton2 = new

javax.swing.JButton(); jButton3 = new

javax.swing.JButton(); jComboBox5 = new

javax.swing.JComboBox<>(); elab = new

javax.swing.JLabel(); jButton4 = new

javax.swing.JButton(); jLabel15 = new

javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
setLocation(new java.awt.Point(50, 118)); setUndecorated(true);

Saket College of arts,science and commerce 156


Hotel management system 226662

Saket College of arts,science and commerce 157


Hotel management system 226662

getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel1.setForeground(new

java.awt.Color(102, 0, 0));

jLabel1.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/Customer Registration & Check
IN.png"))); // NOI18N jLabel1.setText("CUSTOMER CHECKIN");

getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(12,


26, -1, -1));

jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel2.setText("Name");

getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(12,


117, -1, -1));

jTextField1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jTextField1.addActionListener(new java.awt.event.ActionListener()

{ public void actionPerformed(java.awt.event.ActionEvent evt)

{ jTextField1ActionPerformed(evt);

});

jTextField1.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyTyped(java.awt.event.KeyEvent evt)

{ jTextField1KeyTyped(evt);

}); getContentPane().add(jTextField1,
new

Saket College of arts,science and commerce 158


Hotel management system 226662

Saket College of arts,science and commerce 159


Hotel management system 226662

org.netbeans.lib.awtextra.AbsoluteConstraints(12, 152, 350, -1));

jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel3.setText("Mobile

Number");

getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(12,


207, -1, -1));

jTextField2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jTextField2.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyTyped(java.awt.event.KeyEvent evt)

{ jTextField2KeyTyped(evt);

});

getContentPane().add(jTextField2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(12, 242, 350, -1));

jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jLabel4.setText("Nationality");

getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(12,


298, -1, -1));

jTextField3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jTextField3.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyTyped(java.awt.event.KeyEvent evt)

{ jTextField3KeyTyped(evt);

});

Saket College of arts,science and commerce 160


Hotel management system 226662

Saket College of arts,science and commerce 161


Hotel management system 226662

getContentPane().add(jTextField3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(12, 333, 350, -1));

jLabel5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel5.setText("Gender");

getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(12,


383, -1, -1));

jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel6.setText("Email");

getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(12,


472, -1, -1));

jTextField5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jTextField5.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyReleased(java.awt.event.KeyEvent evt)

{ jTextField5KeyReleased(evt);

});

getContentPane().add(jTextField5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(12, 515, 350, -1));

jComboBox1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] {


"Male", "Female", "others" }));

getContentPane().add(jComboBox1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(12, 418, 350, -1));

Saket College of arts,science and commerce 162


Hotel management system 226662

Saket College of arts,science and commerce 163


Hotel management system 226662

jLabel7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel7.setText("ID

Proof");

getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(437,


117, -1, -1));

jTextField4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

getContentPane().add(jTextField4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(440, 200, 350, -1));

jLabel8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jLabel8.setText("Address");

getContentPane().add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(440,


250, -1, -1));

jTextField6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jTextField6.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyTyped(java.awt.event.KeyEvent evt)

{ jTextField6KeyTyped(evt);

});

getContentPane().add(jTextField6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(440, 290, 350, -1));

jLabel9.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jLabel9.setText("Check IN Date(Today)");

getContentPane().add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(440,


340, -1, -1));

Saket College of arts,science and commerce 164


Hotel management system 226662

Saket College of arts,science and commerce 165


Hotel management system 226662

jTextField7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

getContentPane().add(jTextField7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(440, 380, 350, -1));

jLabel10.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jLabel10.setText("Bed");

getContentPane().add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(860,


117, -1, -1));

jComboBox2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] {


"Single", "Double", "Triple" })); jComboBox2.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jComboBox2ActionPerformed(evt);

});

getContentPane().add(jComboBox2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(860, 152, 298, -1));

jLabel11.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jLabel11.setText("Room Type");

getContentPane().add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(860,


207, -1, -1));

jComboBox3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jComboBox3.setModel(new javax.swing.DefaultComboBoxModel<>(new String[]


{ "AC", "NON-AC" }));

Saket College of arts,science and commerce 166


Hotel management system 226662

Saket College of arts,science and commerce 167


Hotel management system 226662

jComboBox3.addActionListener(new java.awt.event.ActionListener() { public

void actionPerformed(java.awt.event.ActionEvent evt)

{ jComboBox3ActionPerformed(evt);

});

getContentPane().add(jComboBox3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(860, 242, 298, -1));

jLabel12.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel12.setText("Room

Number");

getContentPane().add(jLabel12, new org.netbeans.lib.awtextra.AbsoluteConstraints(860,


298, -1, -1));

jComboBox4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jComboBox4.addActionListener(new java.awt.event.ActionListener()

{ public void actionPerformed(java.awt.event.ActionEvent evt)

{ jComboBox4ActionPerformed(evt);

});

jComboBox4.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyTyped(java.awt.event.KeyEvent evt)

{ jComboBox4KeyTyped(evt);

});

getContentPane().add(jComboBox4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(860, 333, 298, -1));

Saket College of arts,science and commerce 168


Hotel management system 226662

Saket College of arts,science and commerce 169


Hotel management system 226662

jLabel13.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel13.setText("Price");

getContentPane().add(jLabel13, new org.netbeans.lib.awtextra.AbsoluteConstraints(860,


383, -1, -1));

jTextField8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jTextField8.addKeyListener(new java.awt.event.KeyAdapter() { public

void keyTyped(java.awt.event.KeyEvent evt)

{ jTextField8KeyTyped(evt);

});

getContentPane().add(jTextField8, new
org.netbeans.lib.awtextra.AbsoluteConstraints(860, 418, 298, -1));

jButton2.setBackground(new java.awt.Color(102, 0, 0));

jButton2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton2.setForeground(new java.awt.Color(255, 255, 255));

jButton2.setText("Allote Room"); jButton2.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jButton2ActionPerformed(evt);

});

getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(860,


468, -1, -1));

jButton3.setBackground(new java.awt.Color(102, 0, 0));

Saket College of arts,science and commerce 170


Hotel management system 226662

Saket College of arts,science and commerce 171


Hotel management system 226662

jButton3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton3.setForeground(new java.awt.Color(255, 255, 255));

jButton3.setText("Clear"); jButton3.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jButton3ActionPerformed(evt);

});

getContentPane().add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(860,


514, -1, -1));

jComboBox5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jComboBox5.setModel(new javax.swing.DefaultComboBoxModel<>(new String[]


{ "Aadhar Card", "Pan Card", "Voter Card" }));

getContentPane().add(jComboBox5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(437, 152, 350, -1));

elab.setForeground(new java.awt.Color(255, 51, 51));

getContentPane().add(elab, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 550,


340, 20));

jButton4.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/close.png"))); // NOI18N

jButton4.addActionListener(new java.awt.event.ActionListener() { public

void actionPerformed(java.awt.event.ActionEvent evt)

{ jButton4ActionPerformed(evt);

});

Saket College of arts,science and commerce 172


Hotel management system 226662

Saket College of arts,science and commerce 173


Hotel management system 226662

getContentPane().add(jButton4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(1170, 0, 30, -1));

jLabel15.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/all pages


background.png"))); // NOI18N

getContentPane().add(jLabel15, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0,


-1, -1));

pack(); setLocationRelativeTo(null);

}// </editor-fold>

private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) { //

TODO add your handling code here:

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

setVisible(false); new

CustomerCheckIn().setVisible(true);

private void jComboBox2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here: roomDetails();

Saket College of arts,science and commerce 174


Hotel management system 226662

Saket College of arts,science and commerce 175


Hotel management system 226662

private void jComboBox3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here: roomDetails();

private void jComboBox4ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

roomNo=(String)jComboBox4.getSelectedItem();

try

ResultSet rs=Select.getData("Select *from room where roomNo='"+roomNo+"'");

while(rs.next())

{ jTextField8.setText(rs.getString(4));

} catch(Exception e)

JOptionPane.showMessageDialog(null, e); }

Saket College of arts,science and commerce 176


Hotel management system 226662

Saket College of arts,science and commerce 177


Hotel management system 226662

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

int id=1;

String name=jTextField1.getText();

String mobileNumber=jTextField2.getText();

String nationality=jTextField3.getText();

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

String email=jTextField5.getText();

String idProof=jTextField4.getText();

String address=jTextField6.getText();

String checkIn=jTextField7.getText();

String bed=(String)jComboBox2.getSelectedItem();

String roomType=(String)jComboBox3.getSelectedItem();

String roomNo=(String)jComboBox4.getSelectedItem();

String Price=jTextField8.getText();

if(name.equals("")||mobileNumber.equals("")||nationality.equals("")||gender.equals("")||email.
equals("")||idProof.equals("")||address.equals("")||checkIn.equals("")||bed.equals("")||roomTyp
e.equals("")||roomNo.equals("")||Price.equals("")){

JOptionPane.showMessageDialog(null,"All fields are required");

if(!(Pattern.matches("^[a-zA-Z0-9]+[@]+gmail+[.]+com",jTextField5.getText()))){

JOptionPane.showMessageDialog(null,"Invalid Email
Format"); }

Saket College of arts,science and commerce 178


Hotel management system 226662

Saket College of arts,science and commerce 179


Hotel management system 226662

else{

String Query="Select max(id) from Customer";

try

ResultSet rs=Select.getData(Query);

while(rs.next()) id=rs.getInt(1);

id=id+1;

if(!Price.equals(""))

Query="update room set status='Booked' where roomNo='"+roomNo+"'";

InsertUpdateDelete.setData(Query,"");

Query="insert into
Customer(id,name,mobileNumber,nationality,gender,email,idProof,address,checkIn,roomNo,
bed,roomType,pricePerDay)
values("+id+",'"+name+"','"+mobileNumber+"','"+nationality+"','"+gender+"','"+email+"','"+i
dProof+"','"+address+"','"+checkIn+"','"+roomNo+"','"+bed+"','"+roomType+"','"+Price+"')";

InsertUpdateDelete.setData(Query,"Customer checkIn successfully");

setVisible(false); new CustomerCheckIn().setVisible(true);

}}

catch(Exception

e)

JOptionPane.showMessageDialog(null,e);

Saket College of arts,science and commerce 180


Hotel management system 226662

Saket College of arts,science and commerce 181


Hotel management system 226662

private void jTextField1KeyTyped(java.awt.event.KeyEvent evt) {

// TODO add your handling code here: char

c=evt.getKeyChar();

if(!(Character.isAlphabetic(c)||(c==KeyEvent.VK_SPACE)||(c==KeyEvent.VK_DELETE)||(c
==KeyEvent.VK_PERIOD)||(c==KeyEvent.VK_BACKSPACE))){

JOptionPane.showMessageDialog(null,"Alphabets only");

getToolkit().beep(); evt.consume();

}}

private void jTextField3KeyTyped(java.awt.event.KeyEvent evt) {

// TODO add your handling code here: char

c=evt.getKeyChar();

if(!(Character.isAlphabetic(c)||(c==KeyEvent.VK_SPACE)||(c==KeyEvent.VK_DELETE)||(c
==KeyEvent.VK_PERIOD)||(c==KeyEvent.VK_BACKSPACE))){

JOptionPane.showMessageDialog(null,"Incorrect Nationality"); getToolkit().beep();

Saket College of arts,science and commerce 182


Hotel management system 226662

Saket College of arts,science and commerce 183


Hotel management system 226662

evt.consume();

}}

private void jTextField2KeyTyped(java.awt.event.KeyEvent evt) {

// TODO add your handling code here: char

c=evt.getKeyChar();

if(!(Character.isDigit(c)||(c==KeyEvent.VK_SPACE)||(c==KeyEvent.VK_DELETE)||(c==Ke
yEvent.VK_PERIOD)||(c==KeyEvent.VK_BACKSPACE))){

JOptionPane.showMessageDialog(null,"Digits

only"); getToolkit().beep(); evt.consume();

private void jComboBox4KeyTyped(java.awt.event.KeyEvent evt) {

// TODO add your handling code here: char

c=evt.getKeyChar();

if(!(Character.isDigit(c)||(c==KeyEvent.VK_SPACE)||(c==KeyEvent.VK_DELETE)||(c==Ke
yEvent.VK_PERIOD)||(c==KeyEvent.VK_BACKSPACE))){

JOptionPane.showMessageDialog(null,"Digits

only"); getToolkit().beep(); evt.consume();

Saket College of arts,science and commerce 184


Hotel management system 226662

Saket College of arts,science and commerce 185


Hotel management system 226662

private void jTextField8KeyTyped(java.awt.event.KeyEvent evt) {

// TODO add your handling code here: char

c=evt.getKeyChar();

if(!(Character.isDigit(c)||(c==KeyEvent.VK_SPACE)||(c==KeyEvent.VK_DELETE)||(c==Ke
yEvent.VK_PERIOD)||(c==KeyEvent.VK_BACKSPACE))){

JOptionPane.showMessageDialog(null,"Digits

only"); getToolkit().beep(); evt.consume();

}}

private void jTextField6KeyTyped(java.awt.event.KeyEvent evt) {

// TODO add your handling code here: char

c=evt.getKeyChar();

if(!(Character.isDigit(c)||(Character.isAlphabetic(c)||(c==KeyEvent.VK_SPACE)||(c==KeyEv
ent.VK_DELETE)||(c==KeyEvent.VK_PERIOD)||(c==KeyEvent.VK_BACKSPACE)))){

JOptionPane.showMessageDialog(null,"Incorrect Address");

getToolkit().beep(); evt.consume();

}}

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

Saket College of arts,science and commerce 186


Hotel management system 226662

Saket College of arts,science and commerce 187


Hotel management system 226662

// TODO add your handling code here:

setVisible(false);

private void jTextField5KeyReleased(java.awt.event.KeyEvent evt) { //

TODO add your handling code here:

if(!(Pattern.matches("^[a-zA-Z0-9]+[@]+gmail+[.]+com$",jTextField5.getText())))

{ elab.setText("Incorrect Format");

else{ elab.setText(n

ull);

/**

* @param args the command line arguments

*/ public static void main(String

args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and
feel.

* For details see


http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */

Saket College of arts,science and commerce 188


Hotel management system 226662

Saket College of arts,science and commerce 189


Hotel management system 226662

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName()))

{ javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(CustomerCheckIn.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(CustomerCheckIn.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(CustomerCheckIn.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(CustomerCheckIn.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);

//</editor-fold>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {

Saket College of arts,science and commerce 190


Hotel management system 226662

Saket College of arts,science and commerce 191


Hotel management system 226662

new CustomerCheckIn().setVisible(true);

});

// Variables declaration - do not modify private


javax.swing.JLabel elab; private javax.swing.JButton
jButton2; private javax.swing.JButton jButton3; private
javax.swing.JButton jButton4; private
javax.swing.JComboBox<String> jComboBox1; private
javax.swing.JComboBox<String> jComboBox2; private
javax.swing.JComboBox<String> jComboBox3; private
javax.swing.JComboBox<String> jComboBox4; private
javax.swing.JComboBox<String> jComboBox5; private
javax.swing.JLabel jLabel1; private javax.swing.JLabel
jLabel10; private javax.swing.JLabel jLabel11; private
javax.swing.JLabel jLabel12; private
javax.swing.JLabel jLabel13; private
javax.swing.JLabel jLabel15; private
javax.swing.JLabel jLabel2; private javax.swing.JLabel
jLabel3; private javax.swing.JLabel jLabel4; private
javax.swing.JLabel jLabel5;

Saket College of arts,science and commerce 192


Hotel management system 226662

Saket College of arts,science and commerce 193


Hotel management system 226662

private javax.swing.JLabel jLabel6; private

javax.swing.JLabel jLabel7; private

javax.swing.JLabel jLabel8; private

javax.swing.JLabel jLabel9; private

javax.swing.JTextField jTextField1; private

javax.swing.JTextField jTextField2; private

javax.swing.JTextField jTextField3; private

javax.swing.JTextField jTextField4; private

javax.swing.JTextField jTextField5; private

javax.swing.JTextField jTextField6; private

javax.swing.JTextField jTextField7; private

javax.swing.JTextField jTextField8;

// End of variables declaration

CustomerCheckOut.java:

import Project.InsertUpdateDelete;
import Project.Select; import
com.itextpdf.text.Paragraph; import
com.itextpdf.text.pdf.PdfPTable; import
com.itextpdf.text.pdf.PdfWriter; import
java.awt.Desktop; import java.io.File;
import java.io.FileOutputStream;
import java.sql.*; import
java.text.SimpleDateFormat;

Saket College of arts,science and commerce 194


Hotel management system 226662

Saket College of arts,science and commerce 195


Hotel management system 226662

import java.util.Calendar; import

java.util.Locale; import

javax.swing.JOptionPane; import

javax.swing.table.DefaultTableModel;

import project.*; import java.io.*; /*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

/**

* @author Lenovo

*/ public class CustomerCheckOut extends

javax.swing.JFrame {

/**

* Creates new form CustomerCheckOut

*/

public CustomerCheckOut() { initComponents();

Saket College of arts,science and commerce 196


Hotel management system 226662

Saket College of arts,science and commerce 197


Hotel management system 226662

jTextField2.setEditable(false);

jTextField3.setEditable(false);

jTextField4.setEditable(false);

jTextField5.setEditable(false);

jTextField6.setEditable(false);

jTextField7.setEditable(false);

jTextField8.setEditable(false);

jTextField9.setEditable(false);

} int

id=0;

String roomType;

String bed;

/**

* This method is called from within the constructor to initialize the form. *

WARNING: Do NOT modify this code. The content of this method is always

* regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code"> private

void initComponents() {

jLabel1 = new javax.swing.JLabel();

Saket College of arts,science and commerce 198


Hotel management system 226662

Saket College of arts,science and commerce 199


Hotel management system 226662

jButton1 = new javax.swing.JButton();


jLabel2 = new javax.swing.JLabel();
jTextField1 = new javax.swing.JTextField();
jButton2 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable(); jLabel3 =
new javax.swing.JLabel(); jTextField2 = new
javax.swing.JTextField(); jLabel4 = new
javax.swing.JLabel(); jTextField3 = new
javax.swing.JTextField(); jLabel5 = new
javax.swing.JLabel(); jTextField4 = new
javax.swing.JTextField(); jLabel6 = new
javax.swing.JLabel(); jTextField5 = new
javax.swing.JTextField(); jLabel7 = new
javax.swing.JLabel(); jTextField6 = new
javax.swing.JTextField(); jLabel8 = new
javax.swing.JLabel(); jTextField7 = new
javax.swing.JTextField(); jLabel9 = new
javax.swing.JLabel(); jTextField8 = new
javax.swing.JTextField(); jLabel10 = new
javax.swing.JLabel(); jTextField9 = new
javax.swing.JTextField(); jButton3 = new
javax.swing.JButton(); jButton4 = new
javax.swing.JButton(); jLabel11 = new
javax.swing.JLabel();

Saket College of arts,science and commerce 200


Hotel management system 226662

Saket College of arts,science and commerce 201


Hotel management system 226662

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setLocation(new java.awt.Point(50, 118)); setUndecorated(true);

addComponentListener(new java.awt.event.ComponentAdapter() { public void

componentShown(java.awt.event.ComponentEvent evt)

{ formComponentShown(evt);

}); getContentPane().setLayout(new

org.netbeans.lib.awtextra.AbsoluteLayout());

jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel1.setForeground(new

java.awt.Color(102, 0, 0));

jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Customer
Check Out.png"))); // NOI18N jLabel1.setText("CUSTOMER

CHECKOUT");

getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(12,


13, -1, -1));

jButton1.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/close.png"))); // NOI18N

jButton1.addActionListener(new java.awt.event.ActionListener() { public

void actionPerformed(java.awt.event.ActionEvent evt)

{ jButton1ActionPerformed(evt);

});

getContentPane().add(jButton1, new

Saket College of arts,science and commerce 202


Hotel management system 226662

Saket College of arts,science and commerce 203


Hotel management system 226662

org.netbeans.lib.awtextra.AbsoluteConstraints(1240, 0, 31, -1));

jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel2.setText("Room

Number");

getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(287,


101, -1, -1));

jTextField1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

getContentPane().add(jTextField1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(406, 98, 107, -1));

jButton2.setBackground(new java.awt.Color(102, 0, 0));

jButton2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton2.setForeground(new java.awt.Color(255, 255, 255));

jButton2.setText("Search"); jButton2.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jButton2ActionPerformed(evt);

});

getContentPane().add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(531,


97, -1, -1));

jTable1.setModel(new javax.swing.table.DefaultTableModel( new

Object [][] {

},

Saket College of arts,science and commerce 204


Hotel management system 226662

Saket College of arts,science and commerce 205


Hotel management system 226662

new String [] {

"ID", "Name", "Mobile Number", "Nationality", "Gender", "Email", "ID Proof",


"Address", "CheckIn Date", "Room Number", "Bed", "Room Type", "Price Per Day"

));

jScrollPane1.setViewportView(jTable1);

getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(10, 390, 1200, 200));

jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jLabel3.setText("Customer Name");

getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(60,


171, -1, -1));

jTextField2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jTextField2.addActionListener(new java.awt.event.ActionListener()

{ public void actionPerformed(java.awt.event.ActionEvent evt)

{ jTextField2ActionPerformed(evt);

});

getContentPane().add(jTextField2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(60, 206, 252, -1));

jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jLabel4.setText("Check IN Date");

getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(347,


171, -1, -1));

Saket College of arts,science and commerce 206


Hotel management system 226662

Saket College of arts,science and commerce 207


Hotel management system 226662

jTextField3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

getContentPane().add(jTextField3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(347, 206, 252, -1));

jLabel5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jLabel5.setText("Check Out Date(Today)");

getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(634,


171, -1, -1));

jTextField4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

getContentPane().add(jTextField4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(634, 206, 252, -1));

jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jLabel6.setText("Customer Mobile Number");

getContentPane().add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(954,


171, -1, -1));

jTextField5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jTextField5.addActionListener(new java.awt.event.ActionListener()

{ public void actionPerformed(java.awt.event.ActionEvent evt)

{ jTextField5ActionPerformed(evt);

});

getContentPane().add(jTextField5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(954, 206, 252, -1));

Saket College of arts,science and commerce 208


Hotel management system 226662

Saket College of arts,science and commerce 209


Hotel management system 226662

jLabel7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jLabel7.setText("Price Per Day");

getContentPane().add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(60,


256, -1, -1));

jTextField6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

getContentPane().add(jTextField6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(60, 291, 252, -1));

jLabel8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jLabel8.setText("Number of Days Stay");

getContentPane().add(jLabel8, new org.netbeans.lib.awtextra.AbsoluteConstraints(347,


256, -1, -1));

jTextField7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

getContentPane().add(jTextField7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(347, 291, 252, -1));

jLabel9.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jLabel9.setText("Total Amount to Collect From Customer");

getContentPane().add(jLabel9, new org.netbeans.lib.awtextra.AbsoluteConstraints(634,


256, -1, -1));

jTextField8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

getContentPane().add(jTextField8, new
org.netbeans.lib.awtextra.AbsoluteConstraints(634, 291, 252, -1));

jLabel10.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

Saket College of arts,science and commerce 210


Hotel management system 226662

Saket College of arts,science and commerce 211


Hotel management system 226662

jLabel10.setText("Email");

getContentPane().add(jLabel10, new org.netbeans.lib.awtextra.AbsoluteConstraints(954,


256, -1, -1));

jTextField9.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

getContentPane().add(jTextField9, new
org.netbeans.lib.awtextra.AbsoluteConstraints(954, 291, 252, -1));

jButton3.setBackground(new java.awt.Color(102, 0, 51));

jButton3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton3.setForeground(new java.awt.Color(255, 255, 255));

jButton3.setText("Check Out"); jButton3.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jButton3ActionPerformed(evt);

});

getContentPane().add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(60,


343, -1, -1));

jButton4.setBackground(new java.awt.Color(102, 0, 0));


jButton4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jButton4.setForeground(new java.awt.Color(255, 255, 255));
jButton4.setText("Clear"); jButton4.addActionListener(new
java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt)
{ jButton4ActionPerformed(evt);

Saket College of arts,science and commerce 212


Hotel management system 226662

Saket College of arts,science and commerce 213


Hotel management system 226662

});

getContentPane().add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(183,


343, -1, -1));

jLabel11.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/all pages


background.png"))); // NOI18N

getContentPane().add(jLabel11, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0,


-1, -1));

pack(); setLocationRelativeTo(null);

}// </editor-fold>

private void jTextField5ActionPerformed(java.awt.event.ActionEvent evt) { //

TODO add your handling code here:

private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) { //

TODO add your handling code here:

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

setVisible(false);

Saket College of arts,science and commerce 214


Hotel management system 226662

Saket College of arts,science and commerce 215


Hotel management system 226662

private void formComponentShown(java.awt.event.ComponentEvent evt) {

// TODO add your handling code here:

ResultSet rs=Select.getData("Select *from Customer where checkOut is NULL");

DefaultTableModel model=(DefaultTableModel)jTable1.getModel();

try

{ while(rs.next())

model.addRow(new
Object[]{rs.getString(1),rs.getString(2),rs.getString(3),rs.getString(4),rs.getString(5),rs.getStr
ing(6),rs.getString(7),rs.getString(8),rs.getString(9),rs.getString(10),rs.getString(11),rs.getStri
ng(12),rs.getString(13)});

} rs.close();

} catch(Exception

e)

JOptionPane.showMessageDialog(null,e);

}}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

String roomNo=jTextField1.getText();

try

Saket College of arts,science and commerce 216


Hotel management system 226662

Saket College of arts,science and commerce 217


Hotel management system 226662

ResultSet rs=Select.getData("select *from Customer where


roomNo='"+roomNo+"'and checkout is NULL");

if(rs.next())

{ jTextField1.setEditable(false);

id=rs.getInt(1);

jTextField2.setText(rs.getString(2));

jTextField3.setText(rs.getString(9));

jTextField5.setText(rs.getString(3));

jTextField6.setText(rs.getString(13));

SimpleDateFormat myFormat=new
SimpleDateFormat("yyyy/MM/dd"); Calendar
cal=Calendar.getInstance();
jTextField4.setText(myFormat.format(cal.getTime())); String
dateBeforeString=rs.getString(9); java.util.Date
dateBefore=myFormat.parse(dateBeforeString); String
dateAfterString=myFormat.format(cal.getTime()); java.util.Date
dateAfter=myFormat.parse(dateAfterString); long
difference=dateAfter.getTime()-dateBefore.getTime(); int
noofDayStay=(int) (difference/(1000*60*60*24)); if(noofDayStay==0)
noofDayStay=1; jTextField7.setText(String.valueOf(noofDayStay));

Saket College of arts,science and commerce 218


Hotel management system 226662

Saket College of arts,science and commerce 219


Hotel management system 226662

float Price=Float.parseFloat(jTextField6.getText());

jTextField8.setText(String.valueOf(noofDayStay*Price));

jTextField9.setText(rs.getString(6));

roomType=rs.getString(12); bed=rs.getString(11);

else

JOptionPane.showMessageDialog(null,"Room Number is not Booked or Room


Number Does not Exist");

} catch(Exception

e)

JOptionPane.showMessageDialog(null,e);

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

setVisible(false); new

CustomerCheckOut().setVisible(true);

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

String name=jTextField2.getText();

Saket College of arts,science and commerce 220


Hotel management system 226662

Saket College of arts,science and commerce 221


Hotel management system 226662

String mobileNumber=jTextField5.getText();

String email=jTextField9.getText();

String checkOut=jTextField4.getText();

String numberofDaysStay=jTextField7.getText();

String totalAmount=jTextField8.getText();

String roomNo=jTextField1.getText();

String Query="update Customer set


numberofDaysStay='"+numberofDaysStay+"',totalAmount='"+totalAmount+"',checkOut='"+
checkOut+"' where id='"+id+"'";

InsertUpdateDelete.setData(Query,"");

Query="update room set status='Not Booked' where roomNo='"+roomNo+"'";

InsertUpdateDelete.setData(Query,""); String path="D:\\";

com.itextpdf.text.Document doc = new com.itextpdf.text.Document();

try

PdfWriter.getInstance(doc,new FileOutputStream(path+""+id+".pdf")); doc.open();

Paragraph paragraph1=new Paragraph(" HOTEL MANAGEMENT SYSTEM\\n");

doc.add(paragraph1);

Paragraph paragraph2=new
Paragraph("*****************************************************************
***********************************************");

doc.add(paragraph2);

Paragraph paragraph3=new Paragraph("\tBill ID:"+id+"\nCustomer


Details:\nName:"+name+"\nMobile Number:"+mobileNumber+"\nEmail:"+email+"\n");

Saket College of arts,science and commerce 222


Hotel management system 226662

Saket College of arts,science and commerce 223


Hotel management system 226662

doc.add(paragraph3); doc.add(paragraph2);

Paragraph paragraph4=new Paragraph("\tRoom


Details:\nNumber:"+jTextField1.getText()+"\nType:"+roomType+"\nBed:"+bed+"\nPrice Per
Day:"+jTextField6.getText()+"");

doc.add(paragraph4); doc.add(paragraph2);

PdfPTable tb1=new PdfPTable(4);

tb1.addCell("Check IN

Date:"+jTextField3.getText()); tb1.addCell("Check

Out Date:"+checkOut); tb1.addCell("No of Days

Stay:"+numberofDaysStay); tb1.addCell("Total

Amount paid:"+totalAmount); doc.add(tb1);

doc.add(paragraph2);

Paragraph paragraph5=new Paragraph("Thank You Please Visit Again");

doc.add(paragraph5);

catch(Exception e)

JOptionPane.showMessageDialog(null,e);

} doc.close();

int a=JOptionPane.showConfirmDialog(null,"Do You Want To Print


Bill","Select",JOptionPane.YES_NO_OPTION); if(a==0)

{ try

Saket College of arts,science and commerce 224


Hotel management system 226662

Saket College of arts,science and commerce 225


Hotel management system 226662

File pdfFile=new File("D:\\"+id+".pdf"); if((new

File("D:\\"+id+".pdf")).exists())

{ if(Desktop.isDesktopSupported())

Desktop.getDesktop().open(pdfFile);

else{

JOptionPane.showMessageDialog(rootPane,"Desktop is not Supported");

else{

JOptionPane.showMessageDialog(rootPane,"File does not exist");

} catch(Exception

e)

JOptionPane.showMessageDialog(null,e);

} } setVisible(false); new

CustomerCheckOut().setVisible(true);

Saket College of arts,science and commerce 226


Hotel management system 226662

Saket College of arts,science and commerce 227


Hotel management system 226662

/**

* @param args the command line arguments

*/ public static void main(String

args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and
feel.

* For details see


http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/ try

for(javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName()))

{ javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(CustomerCheckOut.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(CustomerCheckOut.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

Saket College of arts,science and commerce 228


Hotel management system 226662

Saket College of arts,science and commerce 229


Hotel management system 226662

java.util.logging.Logger.getLogger(CustomerCheckOut.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(CustomerCheckOut.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() { new

CustomerCheckOut().setVisible(true);

});

// Variables declaration - do not modify


private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JLabel jLabel1; private
javax.swing.JLabel jLabel10; private
javax.swing.JLabel jLabel11; private
javax.swing.JLabel jLabel2; private
javax.swing.JLabel jLabel3;

Saket College of arts,science and commerce 230


Hotel management system 226662

Saket College of arts,science and commerce 231


Hotel management system 226662

private javax.swing.JLabel jLabel4; private

javax.swing.JLabel jLabel5; private

javax.swing.JLabel jLabel6; private

javax.swing.JLabel jLabel7; private

javax.swing.JLabel jLabel8; private

javax.swing.JLabel jLabel9; private

javax.swing.JScrollPane jScrollPane1; private

javax.swing.JTable jTable1; private

javax.swing.JTextField jTextField1; private

javax.swing.JTextField jTextField2; private

javax.swing.JTextField jTextField3; private

javax.swing.JTextField jTextField4; private

javax.swing.JTextField jTextField5; private

javax.swing.JTextField jTextField6; private

javax.swing.JTextField jTextField7; private

javax.swing.JTextField jTextField8; private

javax.swing.JTextField jTextField9;

// End of variables declaration

BillDetailsCustomer.java: import
java.text.SimpleDateFormat; import
java.util.Calendar; import
java.sql.*; import Project.*; import
java.awt.Desktop;

Saket College of arts,science and commerce 232


Hotel management system 226662

Saket College of arts,science and commerce 233


Hotel management system 226662

import java.io.File; import

javax.swing.JOptionPane; import

javax.swing.table.DefaultTableModel; import

javax.swing.table.TableModel;

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor. public class CustomerDetailBill extends

javax.swing.JFrame {

public CustomerDetailBill() { initComponents();

SimpleDateFormat myFormat= new SimpleDateFormat("yyyy/MM/dd");

Calendar cal=Calendar.getInstance();

jTextField1.setText(myFormat.format(cal.getTime())); }

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code"> private

void initComponents() {

jLabel1 = new javax.swing.JLabel(); jButton1


= new javax.swing.JButton();

Saket College of arts,science and commerce 234


Hotel management system 226662

Saket College of arts,science and commerce 235


Hotel management system 226662

jLabel2 = new javax.swing.JLabel();

jTextField1 = new javax.swing.JTextField();

jButton2 = new javax.swing.JButton();

jScrollPane1 = new javax.swing.JScrollPane();

jTable1 = new javax.swing.JTable(); jLabel4 =

new javax.swing.JLabel(); jLabel3 = new

javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setLocation(new java.awt.Point(50, 118)); setUndecorated(true);

addComponentListener(new java.awt.event.ComponentAdapter() { public void

componentShown(java.awt.event.ComponentEvent evt)

{ formComponentShown(evt);

}); getContentPane().setLayout(new

org.netbeans.lib.awtextra.AbsoluteLayout());

jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel1.setForeground(new

java.awt.Color(102, 0, 0));

jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Customer
Details Bill.png"))); // NOI18N jLabel1.setText("CUSTOMER

DETAIL BILL");

getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(24,


32, -1, -1));

jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/close.png"))); //
NOI18N

Saket College of arts,science and commerce 236


Hotel management system 226662

Saket College of arts,science and commerce 237


Hotel management system 226662

jButton1.addActionListener(new java.awt.event.ActionListener() { public

void actionPerformed(java.awt.event.ActionEvent evt)

{ jButton1ActionPerformed(evt);

});

getContentPane().add(jButton1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(1230, 10, 30, -1));

jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel2.setText("Search

By Check Out Date");

getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(360,


107, -1, 30));

jTextField1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

getContentPane().add(jTextField1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(560, 110, 200, -1));

jButton2.setBackground(new java.awt.Color(102, 0, 0));

jButton2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N

jButton2.setForeground(new java.awt.Color(255, 255, 255));

jButton2.setText("Search"); jButton2.addActionListener(new

java.awt.event.ActionListener() { public void

actionPerformed(java.awt.event.ActionEvent evt)

{ jButton2ActionPerformed(evt);

}); getContentPane().add(jButton2, new


org.netbeans.lib.awtextra.AbsoluteConstraints(780,

Saket College of arts,science and commerce 238


Hotel management system 226662

Saket College of arts,science and commerce 239


Hotel management system 226662

110, -1, -1));

jTable1.setModel(new javax.swing.table.DefaultTableModel( new

Object [][] {

}, new String

[] {

"ID", "Name", "Mobile Number", "Nationality", "Gender", "Email", "ID Proof",


"Address", "Check IN Date", "Room Number", "Bed", "Room Type", "Price Per Day", "Number
Of Days Stay", "Total Amount", "Check Out Date"

));

jTable1.addMouseListener(new java.awt.event.MouseAdapter() { public

void mouseClicked(java.awt.event.MouseEvent evt)

{ jTable1MouseClicked(evt);

});

jScrollPane1.setViewportView(jTable1);

getContentPane().add(jScrollPane1,new org.netbeans.lib.awtextra.AbsoluteConstraints(20,
150, 1230, 410)); jLabel4.setFont(new java.awt.Font("Algerian",

1, 24)); // NOI18N jLabel4.setForeground(new

java.awt.Color(102, 0, 0)); jLabel4.setText("*Click on Table Row

To Open Bill");

getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(390,


570, -1, -1));

jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/all pages


background.png"))); // NOI18N

Saket College of arts,science and commerce 240


Hotel management system 226662

Saket College of arts,science and commerce 241


Hotel management system 226662

getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -


1, -1));

pack(); setLocationRelativeTo(null);

}// </editor-fold>

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

setVisible(false);

} private void formComponentShown(java.awt.event.ComponentEvent evt) {

// TODO add your handling code here:

ResultSet rs=Select.getData("select *from Customer where checkOut is not NULL");

DefaultTableModel model=(DefaultTableModel)jTable1.getModel();

try

{ while(rs.next())

model.addRow(new
Object[]{rs.getString(1),rs.getString(2),rs.getString(3),rs.getString(4),rs.getString(5),rs.getStr
ing(6),rs.getString(7),rs.getString(8),rs.getString(9),rs.getString(10),rs.getString(11),rs.getStri
ng(12),rs.getString(13),rs.getString(14),rs.getString(15),rs.getString(16)});

} rs.close();

} catch(Exception
e)

Saket College of arts,science and commerce 242


Hotel management system 226662

Saket College of arts,science and commerce 243


Hotel management system 226662

JOptionPane.showMessageDialog(null,e);

} private void jButton2ActionPerformed(java.awt.event.ActionEvent

evt) {

// TODO add your handling code here:

String checkoutDate=jTextField1.getText();

ResultSet rs=Select.getData("select *from Customer where


checkOut='"+checkoutDate+"'");

DefaultTableModel model=(DefaultTableModel)jTable1.getModel(); model.setRowCount(0);

try

{ while(rs.next())

model.addRow(new
Object[]{rs.getString(1),rs.getString(2),rs.getString(3),rs.getString(4),rs.getString(5),rs.getStr
ing(6),rs.getString(7),rs.getString(8),rs.getString(9),rs.getString(10),rs.getString(11),rs.getStri
ng(12),rs.getString(13),rs.getString(14),rs.getString(15),rs.getString(16)});

} rs.close();

} catch(Exception

e)

JOptionPane.showMessageDialog(null,e);

Saket College of arts,science and commerce 244


Hotel management system 226662

Saket College of arts,science and commerce 245


Hotel management system 226662

private void jTable1MouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here: int

index=jTable1.getSelectedRow();

TableModel model=jTable1.getModel();

String id=model.getValueAt(index,0).toString(); try

File pdfFile=new File("D:\\"+id+".pdf"); if((new

File("D:\\"+id+".pdf")).exists())

{ if(Desktop.isDesktopSupported())

Desktop.getDesktop().open(pdfFile);

else{

JOptionPane.showMessageDialog(rootPane,"Desktop is not Supported");

else{

JOptionPane.showMessageDialog(rootPane,"File does not exist");

} catch(Exception e)

JOptionPane.showMessageDialog(null,e);

Saket College of arts,science and commerce 246


Hotel management system 226662

Saket College of arts,science and commerce 247


Hotel management system 226662

} } public static void main(String

args[]) {

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> try

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName()))

{ javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(CustomerDetailBill.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(CustomerDetailBill.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(CustomerDetailBill.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(CustomerDetailBill.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);

//</editor-fold>

Saket College of arts,science and commerce 248


Hotel management system 226662

Saket College of arts,science and commerce 249


Hotel management system 226662

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() { new

CustomerDetailBill().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JButton jButton1; private

javax.swing.JButton jButton2; private

javax.swing.JLabel jLabel1; private

javax.swing.JLabel jLabel2; private

javax.swing.JLabel jLabel3; private

javax.swing.JLabel jLabel4; private

javax.swing.JScrollPane jScrollPane1; private

javax.swing.JTable jTable1; private

javax.swing.JTextField jTextField1;

// End of variables declaration

Saket College of arts,science and commerce 250


Hotel management system 226662

Saket College of arts,science and commerce 251


Hotel management system 226662

6. CONCLUSION

Finally, in the Online hotel management system, we have developed a secure, user-friendly
Hotel Management System. This System can take care of each member whether its Owner or
Customer. This System will Help them to properly Manage their hotel and help in growth
without creating any hassle.

This system is completely secure since every user is provided with a user ID and Password so
there is no chance of any unauthorized access. Online Payment, Booking, and cancellation
make it easier to use. So, using this system will help in reducing the labor and provide more
facility for Customer to like Hotel and visit again and again.

7. REFERENCES:

• www.java.sun.com/docs/books/tutorial
• Kathy Sierra book
• Wrox professional Java
• www.javatpoint.com
• Btech days youtube

Saket College of arts,science and commerce 252


Hotel management system 226662

Saket College of arts,science and commerce 253

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy