Hotel Management System: A.A.R. & B.M.R Degree College
Hotel Management System: A.A.R. & B.M.R Degree College
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
CERTIFICATE
YERRAMOTHU RAJESH
Y163191044
INTRODUCTION
My project title is Hotel Management System. I have tried my best to make the
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
consuming.
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
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
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
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
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.
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.
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:
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 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,”.
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.
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.
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
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;
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();
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);
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
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);
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();
}
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
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
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.
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
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
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