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

Hotel Management System: A.A.R. & B.M.R Degree College

This document summarizes a project on a Hotel Management System submitted by 5 students to Krishna University in partial fulfillment of the requirements for a Bachelor of Science degree. It includes a title page, certificate signed by the project guide and department head confirming the project work, a declaration by the main student, acknowledgements, an introduction on the objectives and operations of the system, system configuration details, and a section on theoretical background of databases.

Uploaded by

kanaka
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
111 views

Hotel Management System: A.A.R. & B.M.R Degree College

This document summarizes a project on a Hotel Management System submitted by 5 students to Krishna University in partial fulfillment of the requirements for a Bachelor of Science degree. It includes a title page, certificate signed by the project guide and department head confirming the project work, a declaration by the main student, acknowledgements, an introduction on the objectives and operations of the system, system configuration details, and a section on theoretical background of databases.

Uploaded by

kanaka
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 79

A PROJECT ON

HOTEL MANAGEMENT SYSTEM

Submitted to
A project submitted to KRISHNA UNVIERSITY
In partial fulfillment of the requirement for the award of Degree of
BACHELOR OF SCIENCE
Submitted by
Y.Rajesh - Y163191044
G.Gopi - Y163191008
M.Ratna Kiran - Y163191022
PB.Bhargav Prasad - Y163191035
Syed Jahid Pasha - Y163191040

Under the Guidance of


Mr. V.V.D.PRASAD
M.C.A

DEPARTMENT OF COMPUTER SCIENCE

A.A.R. & B.M.R DEGREE COLLEGE


Affiliated to Krishna University, Machilipatnam.
2018-2019
DEPARTMENT OF COMPUTER SCIENCE
SRI KAKATIYA DEGREE COLLEGE
Affiliated to Krishna University,
Machilipatnam

CERTIFICATE

This is to certify that the project titled “E-COMPILER”.


Is a bonafide work done by YERRAMOTHU RAJESH
-Reg.No.Y163191044 under my guidance and supervision in
partial fulfillment of the requirement for the award of degree of
Bachelor of Science in SRI KAKATIYA DEGREE
COLLEGE, Eluru road, Vijayawada rural, Affiliated to
Krishna University, Machilipatnam, during the academic year
2018-2019 & completed the project within a period of 12 weeks.

Project Guide Head of the Department


V.V.D. PRASAD V.V.D. PRASAD
M.C.A. M.C.A.
DECLARATION

I hereby declare that this project titled “E-COMPILER”.


Is a bonafide work done by me under the guidance of Mr. V.V.D
PRASAD This project work is submitted to SRI KAKATIYA
DEGREE COLLEGE, Eluru road, Vijayawada rural, in period
fulfillment of the requirement for the award of BACHELOR
OF SCIENCE during the academic year 2018 -2019

I also declare that this project is a result of my own effort and


that it has not been submitted to any other University for the
award of any degree

Date: YERRAMOTHU RAJESH


Place: VIJAYAWADA Y163191044
ACKNOWLEDGEMENT

It is great pleasure to take opportunity and express my gratitude to all those


who helped me throughout my project work.
First and foremost, thankful to SRI A.AJAY KUMAR Principal, SRI
KAKATIYA DEGREE COLLEGE, for giving me opportunity to take up the
project work.
I also thank to Mr. V.V.D. PRASAD, Head of the Department of Computer
Science for giving me opportunity to take up the project work and helping me
through out.
I would also like to thank Mr. V.V.D. PRASAD, Project Guide for her
valuable guidance and support for the completion of my project work.
I would like to express my sincere and heartful thanks to all the faculty of the
Department of Computer Science for their continuous co-operation, which has
given me the guidance to build up adamant aspiration over the completion of my
project.
Finally I thank one and all who directly and indirectly helped me to complete
my project successfully.

YERRAMOTHU RAJESH

Y163191044
INTRODUCTION
My project title is Hotel Management System. I have tried my best to make the

complicated process of Hotel Management System as simple as possible using

Structured & Modular technique & Menu oriented interface. I have tried to design the

Project in such a way that user may not have any difficulty in using this package &

further expansion is possible without much effort. Even though I cannot claim that this

work to be entirely exhaustive, the main purpose of my exercise is perform each

Employee’s activity in computerized way rather than manually which is time

consuming.

I am confident that this software package can be readily used by non-

programming personal avoiding human handled chance of error.

OPERATIONS:
Adding New Rooms To The Hotel:
which requires assigning a room number, type of room whether Air conditioned or

non-air conditioned, current status of room whether free or reserved and charges of

room per day.

Maintaining Rooms:
In this option, employee can check the all information of allthe rooms in hotel or a
particular room by inputting room number and modify itsdetails, like changing status
of room or the charges.
Reserving Room:
here, the employee can check if any free rooms are available inthe hotel database

and subsequently reserve it for a guest.

Generating Bill:
here, at the time of guest checking out, the employee will get the number of days the

guest stayed in a particular room and generate the bill to be paid by the guest

Checking In:
In this guest can enter his personal details in the database if it wishes to stay in the

hotel. After inputting name, address and contact number, the guest details will be

stored for future references.

Checking Out:
In this option it will first ask the guest for the room number it wants to vacate and

then the guest will be checked out of the room and checkout time will be displayed.

Book Room:
Here, guest will be asked which type of room he wishes for and if that type of room

is available then if desired checking in procedure will be initiated.

OBJECTIVE
During the past several decades personnel function has been transformed from a
relatively obscure record keeping staff to central and top level management function.
There are many factors that have influenced this transformation like technological
advances, professionalism, and general recognition of human beings as most
important resources.

 A computer based management system is designed to handle all the primary


information required to calculate monthly statements. Separate database is
maintained to handle all the details required for the correct statement
calculation and generation.

 This project intends to introduce more user friendliness in the various


activities such as record updation, maintenance, and searching.

 The searching of record has been made quite simple as all the details of the
customer can be obtained by simply keying in the identification of that
customer.

 Similarly, record maintenance and updation can also be accomplished by


using the identification of the customer with all the details being automatically
generated. These details are also being promptly automatically updated in the
master file thus keeping the record absolutely up-to-date.

 The entire information has maintained in the database or Files and whoever
wants to retrieve can’t retrieve, only authorization user can retrieve the
necessary information which can be easily be accessible from the file.

The main objective of the entire activity is to automate the process of day to day.
Activities of Hotel like:
 Room activities,
 Admission of a New Customer,
 Assign a room according to customer’s demand,
 Checkout of a customer and releasing the room,
 Finally compute the bill etc.

Existing System:
Here the existing system is nothing but manual traditional paper systems in
which they can post the details of customer. In this system the company will store
the business information in a record which is not safe. We need assign the tasks
and get status of the tasks from an employee manually.
Disadvanatges:

 Difficulty in managing rooms manually.


 Difficulty in preparing bills for each and every time
 Difficulty in updating the details of customer
 Difficulty in tracking the tasks.
Proposed system:
Here the proposed system is to replace an existing system with a
software solution using which we can the details of room booking of a customer
and billing when he/she checkout. Apart from it we can also get the details of
available and non availability of rooms in the hotel.
Advantages:

o Allows efficient manage the tasks.


o Allows the company to record and keep track of the customer details.
o Allows to generate billing at finger tips.

SYSTEM CONFIGURATION
Hardware:

1. Pentium Processor
2. 2.00 GHz, 256 MB DDR SDRAM
3. 80 GB Hard Disk
4. 15” Color Monitor
5. 52X CD-RW
6. Multimedia Keyboard, Optical Mouse.

System Software:
 Operating System: Microsoft Windows
 Front-End: Java
 Back-End: MySQL
 Documentation: MS Word

Theoretical Background
What is Database?
Introduction and Concepts:

A database is a collection of information related to a particular subject or


purpose, such as tracking customer orders or maintaining a product collection.
Using any RDBMS application software like MS SQL Server, MySQL, Oracle,
Sybase etc, you can manage all your information from a single database file. Within
the file, divide your data into separate storage containers called tables. You may and
retrieve the data using queries.

A table is a collection of data about a specific topic, such as products or


suppliers. Using a separate table for each topic means you can store that data only
once, which makes your database more efficient and reduces data-entry errors.
Table organises data into columns (called fields) and rows (called records).

A Primary key is one or more fields whose value or values uniquely identify
each record in a table. In a relationship, a primary key is used to refer to specific
record in one table from another table. A primary key is called foreign key when it is
referred to from another table.

To find and retrieve just the data that meets conditions you specify, including
data from multiple tables, create a query. A query can also update or delete multiple
records at the same time, and perform built-in or custom calculations on your data.
Role of RDBMS Application Program:

A computer database works as a electronic filing system, which has a large number
of ways of cross-referencing, and this allows the user many different ways in which
to re-organize and retrieve data. A database can handle business inventory,
accounting and filing and use the information in its files to prepare summaries,
estimates and other reports. The management of data in a database system is done
by means of a general-purpose software package called a Database Management
System (DBMS). Some commercially available DBMS are MS SQL Server, MS
ACCESS, INGRES, ORACLE, and Sybase. A database management system,
therefore, is a combination of hardware and software that can be used to set up and
monitor a database, and can manage the updating and retrieval of database that
has been stored in it. Most of the database management systems have the following
capabilities:
 Creating of a table, addition, deletion, modification of records.
 Retrieving data collectively or selectively.
 The data stored can be sorted or indexed at the user's discretion and
direction.
 Various reports can be produced from the system. These may be either
standardized report or that may be specifically generated according to specific
user definition.
 Mathematical functions can be performed and the data stored in the database
can be manipulated with these functions to perform the desired calculations.
 To maintain data integrity and database use.

The DBMS interprets and processes users' requests to retrieve information from
a database. In most cases, a query request will have to penetrate several layers of
software in the DBMS and operating system before the physical database can be
accessed. The DBMS responds to a query by invoking the appropriate
subprograms, each of which performs its special function to interpret the query, or to
locate the desired data in the database and present it in the desired order.
What is My SQL ?
The management of data in a database system is done by means of a
general-purpose software package called a Database Management System
(DBMS). Some commercially available RDBMS are MS SQL Server, MS ACCESS,
INGRES, ORACLE, and Sybase.

MySQL, the most popular Open Source SQL database management system, is
developed, distributed, and supported by Oracle Corporation. MySQL is named after
co-founder Monty Widenius's daughter, My. The name of the MySQL Dolphin (our
logo) is “Sakila,”.

 MySQL is a database management system.


A database is a structured collection of data. It may be anything from a simple
shopping list to a picture gallery or the vast amounts of information in a
corporate network. To add, access, and process data stored in a computer
database, you need a database management system such as MySQL Server.
Since computers are very good at handling large amounts of data, database
management systems play a central role in computing, as standalone utilities,
or as parts of other applications.

 MySQL is based on SQL.


A relational database stores data in separate tables rather than putting all the
data in one big storeroom. This adds speed and flexibility. The SQL part of
“MySQL” stands for “Structured Query Language.” SQL is the most common
standardized language used to access databases and is defined by the
ANSI/ISO SQL Standard. The SQL standard has been evolving since 1986
and several versions exist. In this manual, “SQL-92” refers to the standard
released in 1992, “SQL:1999” refers to the standard released in 1999, and
“SQL:2003” refers to the current version of the standard.

 MySQL software is Open Source.


Open Source means that it is possible for anyone to use and modify the
software. Anybody can download the MySQL software from the Internet and
use it without paying anything. If you wish, you may study the source code
and change it to suit your needs. The MySQL software uses the GPL (GNU
General Public License),

 The MySQL Database Server is very fast, reliable, and easy to use.

If that is what you are looking for, you should give it a try. MySQL Server also
has a practical set of features developed in close cooperation with our users.
You can find a performance comparison of MySQL Server with other database
managers on our benchmark page. MySQL Server was originally developed
to handle large databases much faster than existing solutions and has been
successfully used in highly demanding production environments for several
years. Although under constant development, MySQL Server today offers a
rich and useful set of functions. Its connectivity, speed, and security make
MySQL Server highly suited for accessing databases on the Internet.

 MySQL Server works in client/server or embedded systems.

The MySQL Database Software is a client/server system that consists of a


multi-threaded SQL server that supports different backends, several different
client programs and libraries, administrative tools, and a wide range of
application programming interfaces (APIs).

The Main Features of MySQL

 Written in C and C++.


 Works on many different platforms.
 Uses multi-layered server design with independent modules.
 Provides transactional and nontransactional storage engines.
 Designed to make it relatively easy to add other storage engines. This is
useful if you want to provide an SQL interface for an in-house database.
 Uses a very fast thread-based memory allocation system.
 Executes very fast joins using an optimized nested-loop join.
 Implements SQL functions using a highly optimized class library that should
be as fast as possible. Usually there is no memory allocation at all after query
initialization.
 Provides the server as a separate program for use in a client/server
networked environment, and as a library that can be embedded (linked) into
standalone applications. Such applications can be used in isolation or in
environments where no network is available.
 Password security by encryption of all password traffic when you connect to a
server.
 Support for large databases. We use MySQL Server with databases that
contain 50 million records. We also know of users who use MySQL Server
with 200,000 tables and about 5,000,000,000 rows.
 MySQL client programs can be written in many languages. A client library
written in C is available for clients written in C or C++, or for any language that
provides C bindings.
 APIs for C, C++, Eiffel, Java, Perl, PHP, Python, Ruby, and Tcl are available,
enabling MySQL clients to be written in many languages.
 The Connector/ODBC (MyODBC) interface provides MySQL support for client
programs that use ODBC (Open Database Connectivity) connections.
 The Connector/J interface provides MySQL support for Java client programs
that use JDBC connections. Clients can be run on Windows or Unix.
Connector/J source is available.

What is NetBeans IDE ?

NetBeans started as a student project (originally called Xelfi) in the Czech


Republic in 1996. The goal was to write a Delphi-like Java IDE in Java. Xelfi was the
first Java IDE (Integrated Development Environment) written in Java, with its first
pre-releases in 1997. Xelfi was a fun project to work on, especially since Java IDE
space was uncharted territory at that time. The project attracted enough interest that
these students, once they graduated, decided that they could market it as a
commercial product. Soliciting resources from friends and relatives for a web space,
they formed a company around it.

Soon after, they were contacted by Roman Stanek, an entrepreneur who had
already been involved in several startups in the Czech Republic. He was looking for
a good idea to invest in, and discovered Xelfi. He met with the founders; they hit it
off, and a business was born.

In the spring of 1999, NetBeans DeveloperX2 was released, supporting


Swing. The performance improvements that came in JDK 1.3, released in the fall of
1999, made NetBeans a viable choice for development tools. By the summer of
1999, the team was hard at work re-architecting DeveloperX2 into the more modular
NetBeans that forms the basis of the software today.

Something else was afoot in the summer of 1999: Sun Microsystems wanted
better Java development tools, and had become interested in NetBeans. It was a
dream come true for the NetBeans team: NetBeans would become the flagship tool
set of the maker of Java itself! By the Fall, with the next generation of NetBeans
Developer in beta, a deal was struck. Sun Microsystems had also acquired another
tools company, During the acqusition, the young developers who had been involved
in open-source projects for most of their programming careers, mentioned the idea
of open-sourcing NetBeans. Fast forward to less than six months later, the decision
was made that NetBeans would be open sourced. While Sun had contributed
considerable amounts of code to open source projects over the years, this was
Sun's first sponsored open source project, one in which Sun would be paying for the
site and handling the infrastructure.

Features of NetBeans

A free, open-source Integrated Development Environment for software


developers. You get all the tools you need to create professional desktop,
enterprise, web, and mobile applications with the Java platform, as well as C/C++,
PHP, JavaScript, Groovy, and Ruby.

NetBeans IDE 6.9 introduces the JavaFX Composer, support for JavaFX SDK
1.3, OSGi interoperability, support for the PHP Zend framework and Ruby on Rails
3.0, and more.
Source Code:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class Hotel extends JFrame implements ActionListener
{
JPanel p,p1,p2,p3,lgn,cst,regn,bkng,room,bill,main,thnx,mnu,cart,enq;
GridBagLayout gb;
CardLayout cl;
GridBagConstraints gbc;
MyWinLis wl;
MyFocusLis ff;
Connection con;
Statement st;
PreparedStatement ps;
ResultSet rs;
Font mfnt,mfnt1;

//For Login Form


JLabel l1,l2,l56;
JTextField t1;
JPasswordField t2;
JButton b1,b2,b3;

//For Customer Form


JLabel l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16,l17,l17a;
JTextField t3,t4,t5,t6,t7,t8,t9,t10,t11;
JTextArea ta1,ta2;
JComboBox cb1;
JButton b4,b5;
JRadioButton r1,r2,r3,r4,r5,r6;
MyItemLis il;

//For Registration Form


JLabel l18,l19,l20;
JTextField t12;
JPasswordField t13,t14;;
JButton b6,b7;

//For Booking Form


JLabel l21,l22,l23,l24,l25,l26,l27,l28,l29,l29a;
JTextField t15,t16,t17,t18,t19,t20,t21;
JTextArea ta3,ta4;
JButton b8,b9,b12;

//For Rooms Form


JList rlst;
JButton b11;

//For Billing Form


JLabel l31,l32,l33,l34,l35,l37,l38,l39,l40,l41,l42,l43,l44,l45,l48,l49,l49a;
JTextField t24,t25,t26,t27,t28,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39;
JButton b13,b14;
JComboBox cb2;

//For Main Form


JButton b15,b16,b17,b18,b22,b25,b28;
//For Thanks Form
JLabel l46,l47;
JButton b19;

//For Menu Form


JLabel l50,l51,l52,l65a;
JCheckBox c1,c2,c3,c4,c5,c6,c7;
JTextField t40,t41,t42,t43,t44,t45,t46,t47;
JButton b20,b21,b26;

//For Finishing Form


JLabel l53,l54,l55,l57,l58,l59,l60,l61,l62,l63,l64;

//For Enquiry Form


JLabel l66,l67,l68,l69,l70,l71,l72,l73,l74,l75,l76,l78,l79,l80;
JTextField t50,t51,t52,t53,t54,t55,t56,t57,t58,t59;
JTextArea ta5;
JList elst;
JButton b27,b30,b31;

public Hotel()
{
super("Software for Hotel Management System");
p=new JPanel();
p1=new JPanel();
p2=new JPanel();
p3=new JPanel();
lgn=new JPanel();
cst=new JPanel();
regn=new JPanel();
bkng=new JPanel();
room=new JPanel();
bill=new JPanel();
main=new JPanel();
thnx=new JPanel();
mnu=new JPanel();
enq=new JPanel();
gb=new GridBagLayout();
gbc=new GridBagConstraints();
mfnt=new Font("Arial",Font.BOLD,25);
mfnt1=new Font("Comic Sans MS",Font.BOLD,14);
Insets ss=new Insets(5,5,5,5);
gbc.insets=ss;
cl=new CardLayout();

p.setLayout(cl);
gbc.fill=GridBagConstraints.BOTH;
wl=new MyWinLis();
addWindowListener(wl);
ff=new MyFocusLis();

//Initializing Finishing Form Objects


l53=new JLabel("Hotel Management System");
l54=new JLabel(" Login Form");
l55=new JLabel("Welcome to Main Form");
l57=new JLabel(" ");
l58=new JLabel("Customer Details Filling Form");
l59=new JLabel(" ");
l60=new JLabel("Booking Details Filling Form");
l61=new JLabel(" ");
l62=new JLabel("Billing Form");
l63=new JLabel(" ");
l64=new JLabel(" ");
l53.setFont(mfnt);
l54.setFont(mfnt);
l55.setFont(mfnt);
l58.setFont(mfnt);
l60.setFont(mfnt);
l62.setFont(mfnt);

//Initializing Login Form Objects

l1=new JLabel("UserName");
l2=new JLabel("Password");
l56=new JLabel("New User ?");
l1.setFont(mfnt1);
l2.setFont(mfnt1);
l56.setFont(mfnt1);
t1=new JTextField(10);
t2=new JPasswordField(10);
b1=new JButton("Login");
b2=new JButton("Exit");
b3=new JButton("Create New Account");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
lgn.setLayout(gb);
addLogin(l53,1,2,4,1);
addLogin(l54,3,3,2,1);
addLogin(l1,2,5,1,1);
addLogin(l2,2,6,1,1);
addLogin(l56,2,9,1,1);
addLogin(t1,4,5,1,1);
addLogin(t2,4,6,1,1);
addLogin(b1,4,7,1,1);
addLogin(b2,4,8,1,1);
addLogin(b3,4,9,1,1);

//Initializing Customer Form Objects

l3=new JLabel("Customer Code");


l4=new JLabel("Last Name");
l5=new JLabel("First Name");
l6=new JLabel("Sex");
l7=new JLabel("Age");
l8=new JLabel("Maritial status");
l9=new JLabel("Nationality");
l10=new JLabel("Country");
l11=new JLabel("PassPort No.");
l12=new JLabel("Visa No.");
l13=new JLabel("Residential Address");
l14=new JLabel("Official Address(if any)");
l15=new JLabel("Phone No.");
l16=new JLabel("Email ID");
l17=new JLabel("Status");
l17a=new JLabel(" ");
l3.setFont(mfnt1);
l4.setFont(mfnt1);
l5.setFont(mfnt1);
l6.setFont(mfnt1);
l7.setFont(mfnt1);
l8.setFont(mfnt1);
l9.setFont(mfnt1);
l10.setFont(mfnt1);
l11.setFont(mfnt1);
l12.setFont(mfnt1);
l13.setFont(mfnt1);
l14.setFont(mfnt1);
l15.setFont(mfnt1);
l16.setFont(mfnt1);
l17.setFont(mfnt1);
t3=new JTextField(10);
t4=new JTextField(10);
t5=new JTextField(10);
t6=new JTextField(5);
t7=new JTextField(10);
t8=new JTextField(10);
t9=new JTextField(10);
t10=new JTextField(15);
t11=new JTextField(20);
ta1=new JTextArea(5,10);
ta2=new JTextArea(5,10);
cb1=new JComboBox();
cb1.addItem("New");
cb1.addItem("Occasional");
cb1.addItem("Regular");
cb1.addItem("BlackListed");
r1=new JRadioButton("Male");
r2=new JRadioButton("Female");
r3=new JRadioButton("Married");
r4=new JRadioButton("Unmarried");
r5=new JRadioButton("Indian");
r6=new JRadioButton("Foreigner");
b4=new JButton("Save Details");
b5=new JButton("Back to Main");
b4.addActionListener(this);
b5.addActionListener(this);
il=new MyItemLis();
r1.addActionListener(this);
r2.addActionListener(this);
r3.addActionListener(this);
r4.addActionListener(this);
r5.addActionListener(this);
r6.addActionListener(this);
r5.addItemListener(il);
r6.addItemListener(il);
cst.setLayout(gb);
t7.setEnabled(false);
t8.setEnabled(false);
t9.setEnabled(false);
addCustomer(l58,1,1,4,1);
addCustomer(l59,1,2,1,1);
addCustomer(l3,2,4,1,1);
addCustomer(l4,2,5,1,1);
addCustomer(t4,4,5,1,1);
addCustomer(l5,2,6,1,1);
addCustomer(t5,4,6,1,1);
addCustomer(l6,2,7,1,1);
addCustomer(l7,2,8,1,1);
addCustomer(l8,2,9,1,1);
addCustomer(l9,2,10,1,1);
addCustomer(l10,2,11,1,1);
addCustomer(l11,2,12,1,1);
addCustomer(l12,2,13,1,1);
addCustomer(l13,2,14,1,1);
addCustomer(l14,2,16,1,1);
addCustomer(l15,2,18,1,1);
addCustomer(l16,2,19,1,1);
addCustomer(l17,2,20,1,1);
addCustomer(l17a,3,4,1,1);
addCustomer(t3,4,4,1,1);
p1.add(r1);
p1.add(r2);
addCustomer(p1,4,7,1,1);
addCustomer(t6,4,8,1,1);
p2.add(r3);
p2.add(r4);
addCustomer(p2,4,9,1,1);
p3.add(r5);
p3.add(r6);
addCustomer(p3,4,10,1,1);
addCustomer(t7,4,11,1,1);
addCustomer(t8,4,12,1,1);
addCustomer(t9,4,13,1,1);
addCustomer(ta1,4,14,1,1);
addCustomer(ta2,4,16,1,1);
addCustomer(t10,4,18,1,1);
addCustomer(t11,4,19,1,1);
addCustomer(cb1,4,20,1,1);
addCustomer(b4,2,21,1,1);
addCustomer(b5,4,21,1,1);

//Initialising Registration Form

l18=new JLabel("UserName");
l19=new JLabel("Password");
l20=new JLabel("Retype Password");
l18.setFont(mfnt1);
l19.setFont(mfnt1);
l20.setFont(mfnt1);
t12=new JTextField(10);
t13=new JPasswordField(10);
t14=new JPasswordField(10);
b6=new JButton("Save Details");
b7=new JButton("Back");
b6.addActionListener(this);
b7.addActionListener(this);
regn.setLayout(gb);
addRegistration(l18,2,2,1,1);
addRegistration(l19,2,3,1,1);
addRegistration(l20,2,4,1,1);
addRegistration(t12,4,2,1,1);
addRegistration(t13,4,3,1,1);
addRegistration(t14,4,4,1,1);
addRegistration(b6,2,5,1,1);
addRegistration(b7,4,5,1,1);
//Initialising Booking Form Objects

l21=new JLabel("Booking No.");


l22=new JLabel("Customer Code");
l23=new JLabel("Room No.");
l24=new JLabel("Date Of Arrival");
l25=new JLabel("No. Of Persons");
l26=new JLabel("Relationship");
l27=new JLabel("Name");
l28=new JLabel("Address");
l29=new JLabel("Date of Departure");
l29a=new JLabel(" ");
l21.setFont(mfnt1);
l22.setFont(mfnt1);
l23.setFont(mfnt1);
l24.setFont(mfnt1);
l25.setFont(mfnt1);
l26.setFont(mfnt1);
l27.setFont(mfnt1);
l28.setFont(mfnt1);
l29.setFont(mfnt1);
t15=new JTextField(10);
t16=new JTextField(10);
t16.addFocusListener(ff);
t17=new JTextField(10);
t18=new JTextField(10);
t19=new JTextField(10);
t20=new JTextField(10);
t21=new JTextField(10);
ta3=new JTextArea(5,10);
ta4=new JTextArea(5,10);
b8=new JButton("Save Details");
b9=new JButton("Back to Main");
b12=new JButton("Available rooms");
b12.addActionListener(this);
b8.addActionListener(this);
b9.addActionListener(this);
bkng.setLayout(gb);
addBooking(l60,1,1,4,1);
addBooking(l61,1,2,1,1);
addBooking(l21,2,4,1,1);
addBooking(l22,2,5,1,1);
addBooking(l27,2,6,1,1);
addBooking(l28,2,7,1,1);
addBooking(l23,2,10,1,1);
addBooking(l24,2,11,1,1);
addBooking(l29,2,12,1,1);
addBooking(l29a,3,4,1,1);
addBooking(l25,2,13,1,1);
addBooking(l26,2,14,1,1);
addBooking(t15,4,4,1,1);
addBooking(t16,4,5,1,1);
addBooking(t20,4,6,1,1);
addBooking(ta4,4,7,3,1);
addBooking(t17,4,10,1,1);
addBooking(b12,7,10,1,1);
addBooking(t18,4,11,1,1);
addBooking(t21,4,12,1,1);
addBooking(t19,4,13,1,1);
addBooking(ta3,4,14,3,1);
addBooking(b8,2,16,1,1);
addBooking(b9,4,16,1,1);

//Initialising Rooms Form Objects

b11=new JButton("Done");
b11.addActionListener(this);
rlst=new JList();
rlst.setSelectionMode(0);
room.setLayout(gb);
addRooms(rlst,2,2,10,10);
addRooms(b11,4,20,1,1);

//Initialising Billing Form Objects

l31=new JLabel("Bill No.");


l32=new JLabel("Room No.");
l33=new JLabel("Departure Date");
l34=new JLabel("Billing Days");
l35=new JLabel("Total Room Rent");
l37=new JLabel("Service Charges");
l38=new JLabel("Gross Bill Amount");
l39=new JLabel("Service Tax( In %)");
l40=new JLabel("Discount Allowed");
l41=new JLabel("Net Bill Amount");
l42=new JLabel("Amount Recieved");
l43=new JLabel("Outsatnding Amount(if any)");
l44=new JLabel("Billing mode");
l45=new JLabel("Credit Card No.");
l48=new JLabel("Booking No.");
l49=new JLabel("Booking Date");
l49a=new JLabel(" ");
l31.setFont(mfnt1);
l32.setFont(mfnt1);
l33.setFont(mfnt1);
l34.setFont(mfnt1);
l35.setFont(mfnt1);
l37.setFont(mfnt1);
l38.setFont(mfnt1);
l39.setFont(mfnt1);
l40.setFont(mfnt1);
l41.setFont(mfnt1);
l42.setFont(mfnt1);
l43.setFont(mfnt1);
l44.setFont(mfnt1);
l45.setFont(mfnt1);
l48.setFont(mfnt1);
l49.setFont(mfnt1);
t24=new JTextField(10);
t25=new JTextField(10);
t26=new JTextField(10);
t27=new JTextField(10);
t28=new JTextField(10);
t30=new JTextField(10);
t31=new JTextField(10);
t32=new JTextField(10);
t33=new JTextField(10);
t34=new JTextField(10);
t35=new JTextField(10);
t35.addFocusListener(ff);
t36=new JTextField(10);
t37=new JTextField(10);
t37.setEnabled(false);
t37.addFocusListener(ff);
t38=new JTextField(10);
t38.addFocusListener(ff);
t39=new JTextField(10);
b13=new JButton("Save and Print");
b14=new JButton("Thanks");
b13.addActionListener(this);
b14.addActionListener(this);
cb2=new JComboBox();
cb2.addItem("By Cash");
cb2.addItem("By Credit Card");
cb2.addActionListener(this);
bill.setLayout(gb);
addBill(l62,1,1,4,1);
addBill(l63,1,2,1,1);
addBill(l31,2,4,1,1);
addBill(l32,2,5,1,1);
addBill(l48,2,6,1,1);
addBill(l49,2,7,1,1);
addBill(l49a,3,4,1,1);
addBill(l33,2,8,1,1);
addBill(l34,2,9,1,1);
addBill(l35,2,10,1,1);
addBill(l37,2,12,1,1);
addBill(l38,2,13,1,1);
addBill(l39,2,14,1,1);
addBill(l40,2,15,1,1);
addBill(l41,2,16,1,1);
addBill(l44,2,17,1,1);
addBill(l45,2,18,1,1);
addBill(l42,2,19,1,1);
addBill(l43,2,20,1,1);
addBill(t24,4,4,1,1);
addBill(t25,4,6,1,1);
addBill(t38,4,5,1,1);
addBill(t39,4,7,1,1);
addBill(t26,4,8,1,1);
addBill(t27,4,9,1,1);
addBill(t28,4,10,1,1);
addBill(t30,4,12,1,1);
addBill(t31,4,13,1,1);
addBill(t32,4,14,1,1);
addBill(t33,4,15,1,1);
addBill(t34,4,16,1,1);
addBill(cb2,4,17,1,1);
addBill(t37,4,18,1,1);
addBill(t35,4,19,1,1);
addBill(t36,4,20,1,1);
addBill(b13,2,24,1,1);
addBill(b14,4,24,1,1);

//Initialising Main Form Objects

b15=new JButton("Customer's Form");


b16=new JButton("Booking Form");
b17=new JButton("Billing Form");
b18=new JButton("Logout");
b22=new JButton("Services");
b28=new JButton("Enquiry");
b15.addActionListener(this);
b16.addActionListener(this);
b17.addActionListener(this);
b18.addActionListener(this);
b22.addActionListener(this);
b28.addActionListener(this);
main.setLayout(gb);
addMain(l55,1,2,4,1);
addMain(l57,1,4,1,1);
addMain(b15,3,5,1,2);
addMain(b16,4,5,1,2);
addMain(b22,3,7,1,2);
addMain(b17,4,7,1,2);
addMain(b28,3,9,1,2);
addMain(b18,4,9,1,2);

//Initialising Thanks Form Objects

l46=new JLabel("Thanks for using this software.");


l47=new JLabel("This software is developed by 'Mr. Sourabh Bhardwaj '
");
l46.setFont(mfnt);
l47.setFont(mfnt);
b19=new JButton("Return to main Main");
b19.addActionListener(this);
thnx.setLayout(gb);
addThanks(l46,5,4,3,3);
addThanks(l47,5,8,3,3);
addThanks(b19,5,12,3,3);

//Initialising Menu Form Objects

l50=new JLabel("Services provided by the Hotel");


l51=new JLabel("");
l52=new JLabel("");
l65a=new JLabel(" ");
l50.setFont(mfnt);
c1=new JCheckBox("BreakFast");
c2=new JCheckBox("Lunch");
c3=new JCheckBox("Dinner");
c4=new JCheckBox("Laundary");
c5=new JCheckBox("Telephone");
c6=new JCheckBox("Gym");
c7=new JCheckBox("Swimming Pool");
c1.addItemListener(il);
c2.addItemListener(il);
c3.addItemListener(il);
c4.addItemListener(il);
c5.addItemListener(il);
c6.addItemListener(il);
c7.addItemListener(il);
c1.setFont(mfnt1);
c2.setFont(mfnt1);
c3.setFont(mfnt1);
c4.setFont(mfnt1);
c5.setFont(mfnt1);
c6.setFont(mfnt1);
c7.setFont(mfnt1);
t40=new JTextField(10);
t41=new JTextField(10);
t42=new JTextField(10);
t43=new JTextField(10);
t44=new JTextField(10);
t45=new JTextField(10);
t46=new JTextField(10);
t47=new JTextField(10);
t40.setText("0");
t41.setText("0");
t42.setText("0");
t43.setText("0");
t44.setText("0");
t45.setText("0");
t46.setText("0");
t40.setEnabled(false);
t41.setEnabled(false);
t42.setEnabled(false);
t43.setEnabled(false);
t44.setEnabled(false);
t45.setEnabled(false);
t46.setEnabled(false);
b20=new JButton("Total");
b21=new JButton("Back to Main");
b26=new JButton("Ok");
b20.addActionListener(this);
b21.addActionListener(this);
b26.addActionListener(this);
mnu.setLayout(gb);
addMenu(l50,2,1,3,1);
addMenu(l51,2,2,1,1);
addMenu(l52,2,3,1,1);
addMenu(l65a,3,4,1,1);
addMenu(b20,2,11,1,1);
addMenu(c1,2,4,1,1);
addMenu(c2,2,5,1,1);
addMenu(c3,2,6,1,1);
addMenu(c4,2,7,1,1);
addMenu(c5,2,8,1,1);
addMenu(c6,2,9,1,1);
addMenu(c7,2,10,1,1);
addMenu(t40,4,4,1,1);
addMenu(t41,4,5,1,1);
addMenu(t42,4,6,1,1);
addMenu(t43,4,7,1,1);
addMenu(t44,4,8,1,1);
addMenu(t45,4,9,1,1);
addMenu(t46,4,10,1,1);
addMenu(t47,4,11,1,1);
addMenu(b26,2,12,1,1);
addMenu(b21,4,12,1,1);

//Initialising Enquiry Form Objects

l66=new JLabel("Name");
l67=new JLabel("Customer Code");
l68=new JLabel("Age");
l69=new JLabel("Nationality");
l70=new JLabel("Address");
l71=new JLabel("Phone No.");
l72=new JLabel("Email-id");
l73=new JLabel("Alloted Room No.");
l74=new JLabel("Date of Arival");
l75=new JLabel("Date of Departure");
l76=new JLabel("No. of persons");
l66.setFont(mfnt1);
l67.setFont(mfnt1);
l68.setFont(mfnt1);
l69.setFont(mfnt1);
l70.setFont(mfnt1);
l71.setFont(mfnt1);
l72.setFont(mfnt1);
l73.setFont(mfnt1);
l74.setFont(mfnt1);
l75.setFont(mfnt1);
l76.setFont(mfnt1);
l78=new JLabel(" ");
l79=new JLabel("");
l80=new JLabel("Customer's Enquiry Form");
l80.setFont(mfnt);
t50=new JTextField(10);
t50.addFocusListener(ff);
t51=new JTextField(10);
t52=new JTextField(10);
t53=new JTextField(10);
t54=new JTextField(10);
t55=new JTextField(15);
t56=new JTextField(10);
t57=new JTextField(10);
t58=new JTextField(10);
t59=new JTextField(10);
ta5=new JTextArea(5,10);
b27=new JButton("Back to main");
b27.addActionListener(this);
b30=new JButton("Ok");
b30.addActionListener(this);
b31=new JButton("Find");
b31.addActionListener(this);
elst=new JList();
elst.setSelectionMode(0);
//elst.addItem("Customer's Code List");
enq.setLayout(gb);
addEnquiry(l80,2,1,3,1);
addEnquiry(l79,2,2,1,1);
addEnquiry(l78,3,4,1,1);
addEnquiry(l66,2,4,1,1);
addEnquiry(l67,2,5,1,1);
addEnquiry(l69,2,6,1,1);
addEnquiry(l70,2,7,1,1);
addEnquiry(l68,2,8,1,1);
addEnquiry(l71,2,9,1,1);
addEnquiry(l72,2,10,1,1);
addEnquiry(l73,2,11,1,1);
addEnquiry(l74,2,12,1,1);
addEnquiry(l75,2,13,1,1);
addEnquiry(l76,2,14,1,1);
addEnquiry(t50,4,4,1,1);
addEnquiry(t51,4,5,1,1);
addEnquiry(t53,4,6,1,1);
addEnquiry(ta5,4,7,1,1);
addEnquiry(t52,4,8,1,1);
addEnquiry(t54,4,9,1,1);
addEnquiry(t55,4,10,2,1);
addEnquiry(t56,4,11,1,1);
addEnquiry(t57,4,12,1,1);
addEnquiry(t58,4,13,1,1);
addEnquiry(t59,4,14,1,1);
addEnquiry(b27,2,17,1,1);
addEnquiry(b30,8,14,1,1);
addEnquiry(b31,4,17,1,1);
addEnquiry(elst,8,4,20,10);

//Adding Panels

p.add("Login",lgn);
p.add("Customer",cst);
p.add("Registration",regn);
p.add("Booking",bkng);
p.add("Rooms",room);
p.add("Bill",bill);
p.add("Main",main);
p.add("Menu",mnu);
p.add("Thanks",thnx);
p.add("Enquiry",enq);
getContentPane().add(p);
setSize(1024,768);
show();
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:htl");

}
catch(Exception e)
{
t1.setText("Error in Connection ");
}
}
public void addLogin(Component cc,int col,int r,int w,int h)
{
gbc.gridx=col;
gbc.gridy=r;
gbc.gridwidth=w;
gbc.gridheight=h;
gb.setConstraints(cc,gbc);
lgn.add(cc);
}
public void addCustomer(Component cc,int col,int r,int w,int h)
{
gbc.gridx=col;
gbc.gridy=r;
gbc.gridwidth=w;
gbc.gridheight=h;
gb.setConstraints(cc,gbc);
cst.add(cc);
}
public void addRegistration(Component cc,int col,int r,int w,int h)
{
gbc.gridx=col;
gbc.gridy=r;
gbc.gridwidth=w;
gbc.gridheight=h;
gb.setConstraints(cc,gbc);
regn.add(cc);
}
public void addBooking(Component cc,int col,int r,int w,int h)
{
gbc.gridx=col;
gbc.gridy=r;
gbc.gridwidth=w;
gbc.gridheight=h;
gb.setConstraints(cc,gbc);
bkng.add(cc);
}
public void addRooms(Component cc,int col,int r,int w,int h)
{
gbc.gridx=col;
gbc.gridy=r;
gbc.gridwidth=w;
gbc.gridheight=h;
gb.setConstraints(cc,gbc);
room.add(cc);
}
public void addBill(Component cc,int col,int r,int w,int h)
{
gbc.gridx=col;
gbc.gridy=r;
gbc.gridwidth=w;
gbc.gridheight=h;
gb.setConstraints(cc,gbc);
bill.add(cc);
}
public void addMain(Component cc,int col,int r,int w,int h)
{
gbc.gridx=col;
gbc.gridy=r;
gbc.gridwidth=w;
gbc.gridheight=h;
gb.setConstraints(cc,gbc);
main.add(cc);
}
public void addThanks(Component cc,int col,int r,int w,int h)
{
gbc.gridx=col;
gbc.gridy=r;
gbc.gridwidth=w;
gbc.gridheight=h;
gb.setConstraints(cc,gbc);
thnx.add(cc);
}
public void addMenu(Component cc,int col,int r,int w,int h)
{
gbc.gridx=col;
gbc.gridy=r;
gbc.gridwidth=w;
gbc.gridheight=h;
gb.setConstraints(cc,gbc);
mnu.add(cc);
}
public void addEnquiry(Component cc,int col,int r,int w,int h)
{
gbc.gridx=col;
gbc.gridy=r;
gbc.gridwidth=w;
gbc.gridheight=h;
gb.setConstraints(cc,gbc);
enq.add(cc);
}
public void actionPerformed(ActionEvent ee)
{

if(ee.getSource()==b1)
{
try
{
ps=con.prepareStatement("Select * from Users where
UserName=? and Password=?");
ps.setString(1,t1.getText());
ps.setString(2,t2.getText());
rs=ps.executeQuery();
t1.setText("");
t2.setText("");
rs.next();
t1.setText(rs.getString(1));
t2.setText(rs.getString(2));
cl.show(p,"Main");
}
catch(Exception e)
{
t1.setText("Illegal User Name or Password");
t2.setText("");
}
}
if(ee.getSource()==b2)
{
System.exit(0);
}
if(ee.getSource()==b3)
{
cl.show(p,"Registration");
}
if(ee.getSource()==b4)
{
try
{
ps=con.prepareStatement("Insert into Customer
values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
ps.setString(1,t3.getText());
ps.setString(2,t4.getText());
ps.setString(3,t5.getText());
if(r1.isSelected())
{
ps.setString(4,"Male");
}
else
{
ps.setString(4,"Female");
}
ps.setInt(5,Integer.parseInt(t6.getText()));
if(r3.isSelected())
{
ps.setString(6,"Married");
}
else
{
ps.setString(6,"Unmarried");
}
if(r5.isSelected())
{
ps.setString(7,"Indian");
}
else
{
ps.setString(7,"Foreigner");
}
ps.setString(8,t7.getText());
ps.setString(9,t8.getText());
ps.setString(10,t9.getText());
ps.setString(11,ta1.getText());
ps.setString(12,ta2.getText());
ps.setString(13,t10.getText());
ps.setString(14,t11.getText());
ps.setString(15,(String)cb1.getSelectedItem());
int i;
i=ps.executeUpdate();
t3.setText("Customer details successfully added");
t4.setText("");
t5.setText("");
r1.setSelected(true);
r2.setSelected(false);
t6.setText("");
r3.setSelected(false);
r4.setSelected(true);
r5.setSelected(true);
r6.setSelected(false);
t7.setText("");
t8.setText("");
t9.setText("");
ta1.setText("");
ta2.setText("");
t10.setText("");
t11.setText("");
}
catch(Exception e)
{
t3.setText("Error in adding Customer details");
}
}

if(ee.getSource()==b5)
{
cl.show(p,"Main");
}
if(ee.getSource()==b6)
{
try
{
ps=con.prepareStatement("Insert into Users values(?,?)");
String str1,str2;
str1=t13.getText();
str2=t14.getText();
if(str1.equals(str2))
{
ps.setString(1,t12.getText());
ps.setString(2,t13.getText());
int i=ps.executeUpdate();
t12.setText("UserName successfully added");
t13.setText("");
t14.setText(""); }
else
{
t12.setText("Please retype your UserName And
Password correctly");
}
}
catch(Exception e)
{
t12.setText("Error in making new account");
}
}
if(ee.getSource()==b7)
{
cl.show(p,"Login");
t12.setText("");

}
if(ee.getSource()==b8)
{
try
{
ps=con.prepareStatement("Insert into Booking values
(?,?,?,?,?,?,?)");
ps.setString(1,t15.getText());
ps.setString(2,t16.getText());
ps.setInt(3,Integer.parseInt(t17.getText()));
ps.setString(4,t18.getText());
ps.setString(5,t21.getText());
ps.setInt(6,Integer.parseInt(t19.getText()));
ps.setString(7,ta3.getText());
int i;
i=ps.executeUpdate();
ps=con.prepareStatement("Update Rooms set Status=
'NotAvailable' Where RNo=?");
ps.setInt(1,Integer.parseInt(t17.getText()));
i=ps.executeUpdate();
t15.setText("Booking successfully added");
t16.setText("");
t17.setText("");
t20.setText("");
t21.setText("");
ta4.setText("");
t17.setText("");
t18.setText("");
t19.setText("");
ta3.setText("");
}
catch(Exception e)
{
t15.setText("Error in Booking");
}
}
if(ee.getSource()==b9)
{
cl.show(p,"Main");
}
if(ee.getSource()==b11)
{
String rr;
rr=(String)rlst.getSelectedValue();
rr=rr.substring(0,3);
t17.setText(rr);
cl.show(p,"Booking");
}
if(ee.getSource()==b12)
{
String ss[];
ss=new String[50];
int i=0;
try
{
ps=con.prepareStatement("Select * from Rooms where
status='available'");
rs=ps.executeQuery();
while(rs.next())
{
ss[i]=rs.getInt(1) + " " + rs.getString(2) + " " +
rs.getInt(3);
i++;
}
rlst.setListData(ss);
rlst.setVisibleRowCount(5);
}
catch(Exception e)
{
t17.setText("Sorry !! No Rooms are Available");
}
cl.show(p,"Rooms");
}
if(ee.getSource()==b13)
{
try
{
ps=con.prepareStatement("Insert into Billing values
(?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
ps.setString(1,t24.getText());
ps.setString(2,t25.getText());
ps.setString(3,t26.getText());
ps.setInt(4,Integer.parseInt(t27.getText()));
ps.setInt(5,Integer.parseInt(t28.getText()));
ps.setInt(6,Integer.parseInt(t30.getText()));
ps.setInt(7,Integer.parseInt(t31.getText()));
ps.setInt(8,Integer.parseInt(t32.getText()));
ps.setInt(9,Integer.parseInt(t33.getText()));
ps.setInt(10,Integer.parseInt(t34.getText()));
ps.setString(11,(String)cb2.getSelectedItem());
ps.setInt(12,Integer.parseInt(t35.getText()));
ps.setString(13,t37.getText());
ps.setInt(14,Integer.parseInt(t36.getText()));
int i;
i=ps.executeUpdate();

//For printing the bill


PrintUtilities.printComponent(this);
}
catch(Exception e)
{
t24.setText("Error in Billing");
t25.setText("");
t26.setText("");
t27.setText("");
t28.setText("");
t30.setText("");
t31.setText("");
t32.setText("");
t33.setText("");
t34.setText("");
t35.setText("");
t36.setText("");
t37.setText("");
t38.setText("");
t39.setText("");
}
}
if(ee.getSource()==b14)
{
cl.show(p,"Thanks");
t24.setText("");
t25.setText("");
t26.setText("");
t27.setText("");
t28.setText("");
t30.setText("");
t31.setText("");
t32.setText("");
t33.setText("");
t34.setText("");
t35.setText("");
t36.setText("");
t37.setText("");
t38.setText("");
t39.setText("");
}
if(ee.getSource()==b15)
{
int num;
String str;
try
{
ps=con.prepareStatement("Select top 1 * from Customer
order by CCode desc");
rs=ps.executeQuery();
rs.next();
str=rs.getString(1);
num=Integer.parseInt(str.substring(1));
num++;
if(num<10)
{
str="C00" + num;
}
else if(num<100)
{
str="C0" + num;
}
else if(num<1000)
{
str="C" + num;
}
t3.setText(str);
r1.setSelected(true);
r2.setSelected(false);
r3.setSelected(false);
r4.setSelected(true);
r5.setSelected(true);
r6.setSelected(false);

}
catch(Exception e3)
{
t3.setText("Error in Code generation");
}
cl.show(p,"Customer");
}
if(ee.getSource()==b16)
{
int num;
String str;
try
{
ps=con.prepareStatement("Select top 1 * from Booking
order by BNo desc");
rs=ps.executeQuery();
rs.next();
str=rs.getString(1);
num=Integer.parseInt(str.substring(1));
num++;
if(num<10)
{
str="B00" + num;
}
else if(num<100)
{
str="B0" + num;
}
else if(num<1000)
{
str="B" + num;
}
t15.setText(str);
}
catch(Exception e3)
{
t15.setText("Error in Code generation");
}
cl.show(p,"Booking");
t17.setText("");
}
if(ee.getSource()==b17)
{
int num;
String str;
try
{
ps=con.prepareStatement("Select top 1 * from Billing order
by BillNo desc");
rs=ps.executeQuery();
rs.next();
str=rs.getString(1);
num=Integer.parseInt(str.substring(3));
num++;
if(num<10)
{
str="BNo00" + num;
}
else if(num<100)
{
str="BNo0" + num;
}
else if(num<1000)
{
str="BNo" + num;
}
t24.setText(str);
t25.setText("");
t26.setText("");
t27.setText("");
t28.setText("");
t31.setText("");
t32.setText("");
t33.setText("");
t34.setText("");
t35.setText("");
t36.setText("");
t37.setText("");
t38.setText("");
t39.setText("");
}
catch(Exception e3)
{
t24.setText("Error in Code generation");
}
cl.show(p,"Bill");
}
if(ee.getSource()==b18)
{
t1.setText("");
t2.setText("");
cl.show(p,"Login");
}
if(ee.getSource()==b19)
{
cl.show(p,"Main");
}
if(ee.getSource()==b20)
{
int num;
num=0;
num=Integer.parseInt(t40.getText())
+Integer.parseInt(t41.getText())+Integer.parseInt(t42.getText())
+Integer.parseInt(t43.getText())+Integer.parseInt(t44.getText())
+Integer.parseInt(t45.getText())+Integer.parseInt(t46.getText());

t47.setText(String.valueOf(num));
}
if(ee.getSource()==b21)
{
cl.show(p,"Main");
t40.setText("0");
t41.setText("0");
t42.setText("0");
t43.setText("0");
t44.setText("0");
t45.setText("0");
t46.setText("0");
t47.setText("0");
}
if(ee.getSource()==b22)
{
c1.setSelected(false);
c2.setSelected(false);
c3.setSelected(false);
c4.setSelected(false);
c5.setSelected(false);
c6.setSelected(false);
c7.setSelected(false);
cl.show(p,"Menu");

}
if(ee.getSource()==b26)
{
try
{
t30.setText(t47.getText());
t40.setEnabled(true);
t40.setText("Details added successfully");
t41.setText("0");
t42.setText("0");
t43.setText("0");
t44.setText("0");
t45.setText("0");
t46.setText("0");
}
catch(Exception e)
{
t40.setEnabled(true);
t40.setText("Error in adding details");
t41.setText("0");
t42.setText("0");
t43.setText("0");
t44.setText("0");
t45.setText("0");
t46.setText("0");
}
}
if(ee.getSource()==b27)
{
cl.show(p,"Main");
}
if(ee.getSource()==b28)
{
t50.setText("");
t51.setText("");
t53.setText("");
ta5.setText("");
t52.setText("");
t54.setText("");
t55.setText("");
t56.setText("");
t57.setText("");
t58.setText("");
t59.setText("");
cl.show(p,"Enquiry");
}
if(ee.getSource()==b30)
{
try
{
String rr;
rr=(String)elst.getSelectedValue();
t51.setText(rr);
t53.setText("");
ta5.setText("");
t52.setText("");
t54.setText("");
t55.setText("");
t56.setText("");
t57.setText("");
t58.setText("");
t59.setText("");
}
catch(Exception ee2)
{
t51.setText("Can not find record");
t53.setText("");
ta5.setText("");
t52.setText("");
t54.setText("");
t55.setText("");
t56.setText("");
t57.setText("");
t58.setText("");
t59.setText("");
}
}
if(ee.getSource()==b31)
{
try
{
ps=con.prepareStatement("Select * from Customer
where CCode=?");
ps.setString(1,t51.getText());
rs=ps.executeQuery();
rs.next();
t53.setText(rs.getString(7));
ta5.setText(rs.getString(11));
t52.setText(String.valueOf(rs.getInt(5)));
t54.setText(String.valueOf(rs.getString(13)));
t55.setText(rs.getString(14));
ps=con.prepareStatement("Select * from Booking
where Ccode=?");
ps.setString(1,t51.getText());
rs=ps.executeQuery();
rs.next();
t56.setText(String.valueOf(rs.getInt(3)));
t57.setText(rs.getString(4));
t58.setText(rs.getString(5));
t59.setText(String.valueOf(rs.getInt(6)));
}
catch(Exception ee1)
{
t51.setText("Error in Record finding");
t50.setText("");
t53.setText("");
ta5.setText("");
t52.setText("");
t54.setText("");
t55.setText("");
t56.setText("");
t57.setText("");
t58.setText("");
t59.setText("");
}

}
if(ee.getSource()==r1)
{
r2.setSelected(false);
r1.setSelected(true);
}
if(ee.getSource()==r2)
{
r1.setSelected(false);
r2.setSelected(true);
}
if(ee.getSource()==r3)
{
r4.setSelected(false);
r3.setSelected(true);
}
if(ee.getSource()==r4)
{
r3.setSelected(false);
r4.setSelected(true);
}
if(ee.getSource()==r5)
{
r6.setSelected(false);
r5.setSelected(true);
}
if(ee.getSource()==r6)
{
r5.setSelected(false);
r6.setSelected(true);
}
if(ee.getSource()==cb2)
{
String str;
str=(String)cb2.getSelectedItem();
if(str.equals("By Credit Card"))
{
t37.setEnabled(true);
t35.setEnabled(true);
}
else if(str.equals("By Cash"))
{
t37.setEnabled(false);
t35.setEnabled(true);
}
}

}
public static void main(String a[])
{
Hotel ht =new Hotel();
}
class MyWinLis extends WindowAdapter
{
public void windowClosing(WindowEvent w)
{
Hotel ht;
ht=(Hotel)w.getSource();
ht.dispose();
System.exit(0);
}
}
class MyFocusLis implements FocusListener
{
public void focusGained(FocusEvent e)
{
}
public void focusLost(FocusEvent e)
{
if(e.getSource()==t16)
{
try
{
ps=con.prepareStatement("Select * from Customer where
CCode=?");
ps.setString(1,t16.getText());
rs=ps.executeQuery();
rs.next();
t20.setText(rs.getString(3) + " " + rs.getString(2));
ta4.setText(rs.getString(11));
}
catch(Exception ex)
{
t13.setText("Invalid Customer No. ! Try Again");
t20.setText("");
ta4.setText("");

}
}
if(e.getSource()==t38)
{
try
{
ps=con.prepareStatement("Select * from Booking where
RNo=?");
ps.setString(1,t38.getText());
rs=ps.executeQuery();
rs.next();
t25.setText(rs.getString(1));
t39.setText(rs.getString(4));
ps=con.prepareStatement("Select Date()");
rs=ps.executeQuery();
rs.next();
t26.setText(rs.getString(1));
ps=con.prepareStatement("Select DateDiff('d',?,?)");
ps.setString(1,t39.getText());
ps.setString(2,t26.getText());
rs=ps.executeQuery();
rs.next();
t27.setText(rs.getString(1));
ps=con.prepareStatement("Select * from Rooms where
RNo=?");
ps.setString(1,t38.getText());
rs=ps.executeQuery();
rs.next();
int rent;
rent=rs.getInt(3)*Integer.parseInt(t27.getText());
t28.setText(String.valueOf(rent));
int amt,st,ar;
amt=Integer.parseInt(t28.getText())
+Integer.parseInt(t30.getText());
t31.setText(String.valueOf(amt)) ;
st=amt*10/100;
t32.setText(String.valueOf(st));
t33.setText("0");
amt=amt+st;
t34.setText(String.valueOf(amt));
}
catch(Exception ex)
{
t25.setText("Invalid Booking No. ! Try Again " +
ex.getMessage());
}
}

if(e.getSource()==t35)
{
int ar;
ar=Integer.parseInt(t34.getText())-
Integer.parseInt(t35.getText());
t36.setText(String.valueOf(ar)) ;
}
if(e.getSource()==t37)
{
t35.setText(String.valueOf(t34.getText()));
}
if(e.getSource()==t50)
{

String ss[];
ss=new String[20];
int i=0;
try
{
ps=con.prepareStatement("Select * from Customer
where FName=?");
ps.setString(1,t50.getText());
rs=ps.executeQuery();
while(rs.next())
{
ss[i]=rs.getString(1);
i++;
}
elst.setListData(ss);
elst.setVisibleRowCount(5);
t51.setText("");
t53.setText("");
ta5.setText("");
t52.setText("");
t54.setText("");
t55.setText("");
t56.setText("");
t57.setText("");
t58.setText("");
t59.setText("");

}
catch(Exception e1)
{
t51.setText("Sorry !! No such record Available");
}

}
}

}
class MyItemLis implements ItemListener
{
public void itemStateChanged(ItemEvent ee)
{
if(ee.getSource()==r6)
{
if(r6.isSelected())
{
t7.setEnabled(true);
t8.setEnabled(true);
t9.setEnabled(true);
}
else
{
t7.setEnabled(false);
t8.setEnabled(false);
t9.setEnabled(false);
}
}
if(ee.getSource()==c1)
{
if(c1.isSelected())
{
t40.setEnabled(true);
t40.setText("");
}
else
{
t40.setEnabled(false);
t40.setText("0");
}
}
if(ee.getSource()==c2)
{
if(c2.isSelected())
{
t41.setEnabled(true);
t41.setText("");
}
else
{
t41.setEnabled(false);
t41.setText("0");
}
}
if(ee.getSource()==c3)
{
if(c3.isSelected())
{
t42.setEnabled(true);
t42.setText("");
}
else
{
t42.setEnabled(false);
t42.setText("0");
}
}
if(ee.getSource()==c4)
{
if(c4.isSelected())
{
t43.setEnabled(true);
t43.setText("");
}
else
{
t43.setEnabled(false);
t43.setText("0");
}
}
if(ee.getSource()==c5)
{
if(c5.isSelected())
{
t44.setEnabled(true);
t44.setText("");
}
else
{
t44.setEnabled(false);
t44.setText("0");
}
}
if(ee.getSource()==c6)
{
if(c6.isSelected())
{
t45.setEnabled(true);
t45.setText("");
}
else
{
t45.setEnabled(false);
t45.setText("0");
}
}
if(ee.getSource()==c7)
{
if(c7.isSelected())
{
t46.setEnabled(true);
t46.setText("");
}
else
{
t46.setEnabled(false);
t46.setText("0");
}
}
}
}
}
User Manual

Login Form:-
Main Form:-
Customer Form:-
Booking Form:-
Billing Form:-
Enquiry Form:-
CONCLUSION
The project is based on the operational aspects of a hotel and a study of all the

functions of the different department in the hotel.

It gives complete exposure of the requirement of the management for smooth

functioning. The management policies differ from one hotel to another in thus

outlook but there is not much difference in the functioning of the hotels.

I also would like to thank all the teachers of BCA and especially Mr. Vijay Thakur

in giving me the guidance in completing the project.

The objective of the project was to study the various aspects of a hotel in general

and the front office, housekeeping and the food and beverage departments in the

depth to identify its drawbacks and suggest suitable solution during training period.

The study is limited by lack of time and information.

There are different forms and tables are used. The data is stored in tables

automatically. I tried my best to do this project. However the whole system can not

be changed, but the computerized system designed not only saves time but at the

same time reduces labour & expenditures. In traditional system, there were lot of

irregularities founds in generating data to where as in modified and computerized

system in every problem overcome with the press of button. This system provides

the security from loss, disclosure, modification and destruction of data. This system

provides integrity of proper functioning of programs.

BIBLIOGRAPHY
Here I would like to mention about the sources of information in due course of

writing the project report & would like to state that the information obtained through

different presentation & news article has greatly contributed to the successful

completion of the project. The list of different sources is mentioned below:

 John Zokowski ,Java 2 J2SE 1.4

 Y. Daniel Liang ,An Introduction to Java Programming

 Patrick Naughton ,The Complete Reference Java 2

 C.Desai,Data Base System

 Kalyani publications, Database Management System

You might also like