Hotel Documentation

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

Hotel booking system 79

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:

[Type here] [Type here] [Type here]


Hotel booking system 79

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

2
Hotel booking system 79

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.

[Type here] [Type here] [Type here]


Hotel booking system 79

1.5 Project Plan and Gantt chart:

1.6 Process 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
provides support for risk handling. In its diagrammatic representation, it looks like a spiral with
many loops. the exact number of loops of the spiral is unknown and can vary from project to
project. Each loop of the spiral is called a phase of the software development process. The exact
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 using th e spiral
Model.

4
Hotel booking system 79

[Type here] [Type here] [Type here]


Hotel booking system 79

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

6
Hotel booking system 79

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.

[Type here] [Type here] [Type here]


Hotel booking system 79

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

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

8
Hotel booking system 79

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
[Type here] [Type here] [Type here]
Hotel booking system 79

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

10
Hotel booking system 79

3. SYSTEM DESIGN

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

[Type here] [Type here] [Type here]


Hotel booking system 79

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

12
Hotel booking system 79

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
control flow, 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 data -flow diagram. A
special form of data-flow plan is a site-oriented data

DFD Level 0:-

Hotel Reservation
Customer Management Subsystem
System

DFD Level 1:

2
1 Choose facility 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

13
Hotel booking system 79

Saket College of arts,science and commerce

14
Hotel management system 226662

Saket College of arts,science and


commerce 15
Hotel booking system 79

Saket College of arts,science and commerce

16
Hotel management system 226662

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

Saket College of arts,science and


commerce 17
Hotel booking system 79

18
Hotel booking system 79

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.

19
Hotel booking system 79

20
Hotel booking system 79

3.5 Class Diagram

A class diagram describes the static structure of the symbols in your new system. It is a graphic
presentation of the static view that shows a collection of declarati ve (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 with other

21
Hotel booking system 79

4. OUTPUT SCREENS:

SIGNUP PAGE:

LOGIN PAGE

22
Hotel booking system 79

FORGOT PASSWORD PAGE :

MANAGE ROOM :

23
Hotel booking system 79

CUSTOMER CHECKIN:

CUSTOMER CHECKOUT:

24
Hotel booking system 79

BILL DETAILS OF CUSTOMER:

25
Hotel booking system 79

26
Hotel booking system 79

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

*/

27
Hotel booking system 79

28
Hotel booking system 79

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

29
Hotel booking system 79

30
Hotel booking system 79

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

31
Hotel booking system 79

32
Hotel booking system 79

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

33
Hotel booking system 79

34
Hotel booking system 79

});

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)


{

35
Hotel booking system 79

36
Hotel booking system 79

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,

37
Hotel booking system 79

38
Hotel booking system 79

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

39
Hotel booking system 79

40
Hotel booking system 79

});

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

41
Hotel booking system 79

42
Hotel booking system 79

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

43
Hotel booking system 79

44
Hotel booking system 79

});

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,

45
Hotel booking system 79

46
Hotel booking system 79

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

47
Hotel booking system 79

48
Hotel booking system 79

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

49
Hotel booking system 79

50
Hotel booking system 79

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

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

51
Hotel booking system 79

52
Hotel booking system 79

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

53
Hotel booking system 79

54
Hotel booking system 79

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

55
Hotel booking system 79

56
Hotel booking system 79

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

57
Hotel booking system 79

58
Hotel booking system 79

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

59
Hotel booking system 79

60
Hotel booking system 79

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

61
Hotel booking system 79

62
Hotel booking system 79

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

63
Hotel booking system 79

64
Hotel booking system 79

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

65
Hotel booking system 79

66
Hotel booking system 79

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,

67
Hotel booking system 79

68
Hotel booking system 79

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

69
Hotel booking system 79

70
Hotel booking system 79

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

71
Hotel booking system 79

72
Hotel booking system 79

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

73
Hotel booking system 79

74
Hotel booking system 79

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;

75
Hotel booking system 79

76
Hotel booking system 79

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

77
Hotel booking system 79

78
Hotel booking system 79

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() {

79
Hotel booking system 79

80
Hotel booking system 79

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

81
Hotel booking system 79

82
Hotel booking system 79

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

83
Hotel booking system 79

84
Hotel booking system 79

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

85
Hotel booking system 79

86
Hotel booking system 79

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

87
Hotel booking system 79

88
Hotel booking system 79

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

89
Hotel booking system 79

90
Hotel booking system 79

});

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

91
Hotel booking system 79

92
Hotel booking system 79

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:

93
Hotel booking system 79

94
Hotel booking system 79

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)

95
Hotel booking system 79

96
Hotel booking system 79

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 {

97
Hotel booking system 79

98
Hotel booking system 79

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

99
Hotel booking system 79

100
Hotel booking system 79

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

101
Hotel booking system 79

102
Hotel booking system 79

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

}}

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

103
Hotel booking system 79

104
Hotel booking system 79

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;

105
Hotel booking system 79

106
Hotel booking system 79

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

107
Hotel booking system 79

108
Hotel booking system 79

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

});

109
Hotel booking system 79

110
Hotel booking system 79

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

111
Hotel booking system 79

112
Hotel booking system 79

});

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

113
Hotel booking system 79

114
Hotel booking system 79

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

115
Hotel booking system 79

116
Hotel booking system 79

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


{

117
Hotel booking system 79

118
Hotel booking system 79

// 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) {

119
Hotel booking system 79

120
Hotel booking system 79

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;

121
Hotel booking system 79

122
Hotel booking system 79

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

*/

123
Hotel booking system 79

124
Hotel booking system 79

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

125
Hotel booking system 79

126
Hotel booking system 79

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

127
Hotel booking system 79

128
Hotel booking system 79

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

129
Hotel booking system 79

130
Hotel booking system 79

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

131
Hotel booking system 79

132
Hotel booking system 79

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

133
Hotel booking system 79

134
Hotel booking system 79

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>

135
Hotel booking system 79

136
Hotel booking system 79

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

137
Hotel booking system 79

138
Hotel booking system 79

{ 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(null);

139
Hotel booking system 79

140
Hotel booking system 79

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

}}

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:

141
Hotel booking system 79

142
Hotel booking system 79

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;

143
Hotel booking system 79

144
Hotel booking system 79

} 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

145
Hotel booking system 79

146
Hotel booking system 79

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.*;

147
Hotel booking system 79

148
Hotel booking system 79

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

149
Hotel booking system 79

150
Hotel booking system 79

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

151
Hotel booking system 79

152
Hotel booking system 79

/**

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

153
Hotel booking system 79

154
Hotel booking system 79

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

155
Hotel booking system 79

156
Hotel booking system 79

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

157
Hotel booking system 79

158
Hotel booking system 79

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

});

159
Hotel booking system 79

160
Hotel booking system 79

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

161
Hotel booking system 79

162
Hotel booking system 79

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

163
Hotel booking system 79

164
Hotel booking system 79

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

165
Hotel booking system 79

166
Hotel booking system 79

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

167
Hotel booking system 79

168
Hotel booking system 79

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

169
Hotel booking system 79

170
Hotel booking system 79

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

});

171
Hotel booking system 79

172
Hotel booking system 79

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

173
Hotel booking system 79

174
Hotel booking system 79

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

175
Hotel booking system 79

176
Hotel booking system 79

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


}

177
Hotel booking system 79

178
Hotel booking system 79

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

179
Hotel booking system 79

180
Hotel booking system 79

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

181
Hotel booking system 79

182
Hotel booking system 79

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

183
Hotel booking system 79

184
Hotel booking system 79

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

185
Hotel booking system 79

186
Hotel booking system 79

// 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(null);

/**

* @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 */

187
Hotel booking system 79

188
Hotel booking system 79

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() {

189
Hotel booking system 79

190
Hotel booking system 79

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;

191
Hotel booking system 79

192
Hotel booking system 79

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;

193
Hotel booking system 79

194
Hotel booking system 79

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

195
Hotel booking system 79

196
Hotel booking system 79

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

197
Hotel booking system 79

198
Hotel booking system 79

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

199
Hotel booking system 79

200
Hotel booking system 79

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

201
Hotel booking system 79

202
Hotel booking system 79

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 [][] {

},

203
Hotel booking system 79

204
Hotel booking system 79

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

205
Hotel booking system 79

206
Hotel booking system 79

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

207
Hotel booking system 79

208
Hotel booking system 79

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

209
Hotel booking system 79

210
Hotel booking system 79

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

211
Hotel booking system 79

212
Hotel booking system 79

});

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

213
Hotel booking system 79

214
Hotel booking system 79

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

215
Hotel booking system 79

216
Hotel booking system 79

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

217
Hotel booking system 79

218
Hotel booking system 79

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

219
Hotel booking system 79

220
Hotel booking system 79

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

221
Hotel booking system 79

222
Hotel booking system 79

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

223
Hotel booking system 79

224
Hotel booking system 79

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

225
Hotel booking system 79

226
Hotel booking system 79

/**

* @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) {

227
Hotel booking system 79

228
Hotel booking system 79

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;

229
Hotel booking system 79

230
Hotel booking system 79

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;

231
Hotel booking system 79

232
Hotel booking system 79

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

233
Hotel booking system 79

234
Hotel booking system 79

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

235
Hotel booking system 79

236
Hotel booking system 79

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,

237
Hotel booking system 79

238
Hotel booking system 79

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

239
Hotel booking system 79

240
Hotel booking system 79

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)

241
Hotel booking system 79

242
Hotel booking system 79

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

243
Hotel booking system 79

244
Hotel booking system 79

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

245
Hotel booking system 79

246
Hotel booking system 79

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

247
Hotel booking system 79

248
Hotel booking system 79

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

249
Hotel booking system 79

250
Hotel booking system 79

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

251
Hotel booking system 79

252

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