Documente Academic
Documente Profesional
Documente Cultură
ON
FOR
AISSCE 2018- 2019 EXAMINATION
As a part of the Informatics Practices Course (065)
SUBMITTED BY:
Page 1
ACKNOWLEDGEMENT
I thank the institution for giving us this opportunity to encase and display
our talents through this project.
I thank the chairman of Sri Chaitanya Educational Institutions Mr. B S
RAO for giving us the infrastructure and materials required to this project.
I am grateful to the principal of Sri Chaitanya Techno School for
motivating us and believing in us that we could do this project.
I am also grateful to the CBSE board for challenging us and giving us this
project in which all of us were so engrossed to do the project.
I am very thankful and grateful to our Informatics Practices teacher MrS.
TANUJA for imparting the knowledge to us and standing by us and
guiding us whenever we were wrong.
I am also thankful to my teammates who helped me in getting the right
information for this project.
Page 2
TABLE OF CONTENTS
SNo Topic Name PgNo
1. Abstract 4
2. System requirements 5
3. Database design 6-8
4. Coding 9-29
5. Output screens 30-36
6. Bibliography 37
Page 3
ABSTRACT
This is a project on the topic “Hotel HYATT”. In this Project we have tried
to bring out a new form of COMMERCIAL Websites. We have made a single
database for both the customer as well as the manager.
The opening page gives us two buttons to choose if the user is a customer or
a manager. If the “customer” button is clicked, a menu page opens in which the
customer is allowed to choose the dishes he desires. He/She is required to give
his/her name so as to obtain the bill amount. When He/She clicks on the next
button a pop up is obtained saying “Money will be collected on delivery” and
redirects the user to a “feedback” form. On submission of the feedback form, the
user is redirected to a “Thank You” page.
If the user selects the “Manager” button in the main page, a form opens
asking for the username and password. If the credentials are correct then a
menu page opens which gives the manager an opportunity to insert, modify or
delete any of the item prices. The manager can also skip this page. On clicking
the “next/skip” button, a page is opened in which the customer’s details can be
accessed. On clicking the “exit” button the manager automatically logs out.
Page 4
SYSTEM REQUIREMENTS
Hardware components
V G A Monitor
Qwerty Keyboard
512 Mb RAM
2.6 GHz Processor
Graphics card
Software components
Windows 7
NetBeans IDE 7.3.1 or Higher
MySQL command client
Page 5
DATABASE DESIGN
Cust
Room
Bill
Page 6
Page 7
Page 8
FORMS
Page 9
Page
10
Page
11
Page
12
Page
13
CODING
Source code for “Login” Button in “Home page” form:
new J2().setVisible(true);
String u,p;
u=jTextField1.getText();
p=jPasswordField1.getText();
if(u.equalsIgnoreCase("e01") &&p.equalsIgnoreCase("password"))
new J1().setVisible(true);
else{
new J4().setVisible(true);
new J6().setVisible(true);
new J9().setVisible(true);
System.exit(0);
Source code for “Book ” Button in “Booking page” form:
String gender="";
String s1="No";
String Room=t5.getText();
String Name=t1.getText();
String Mobile=t4.getText();
String age=t3.getText();
String np=t2.getText();
String cid=t6.getText();
String cod =t7.getText();
String ID=(cb2.getSelectedItem()).toString();
Page
15
if(rb_male.isSelected())
{
gender="Male";
}
else if(rb_female.isSelected())
{
gender="Female";
}
if(Name.isEmpty())
JOptionPane.showMessageDialog(this,"Name not Entered");
else if(age.isEmpty())
JOptionPane.showMessageDialog(this,"Age not Entered");
else if(np.isEmpty())
JOptionPane.showMessageDialog(this,"No of persons not Entered");
else if(Mobile.isEmpty())
JOptionPane.showMessageDialog(this,"Contact No not Entered");
else if(gender.isEmpty())
JOptionPane.showMessageDialog(null, "Select a Gender Type");
else if(Room.isEmpty())
JOptionPane.showMessageDialog(this,"Room No not Entered");
else if(cid.isEmpty())
JOptionPane.showMessageDialog(this,"Check in date not Entered");
else if(cod.isEmpty())
Page
16
JOptionPane.showMessageDialog(this,"Please enter approximate Check
out date");
else {
try{Class.forName("com.mysql.jdbc.Driver");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/
hyatt","root","root");
Statement stmt=null;
stmt=con.createStatement();
String query="INSERT INTO cust(c_name, nps,age , contact_no,
gender,rno, cid, cod,id) VALUES('"+Name+"', '"+np+"', '"+age+"',
'"+Mobile+"', '"+gender+"', '"+Room+"', '"+cid+"', '"+cod+"',
'"+ID+"');";
intqexecute=stmt.executeUpdate(query);
JOptionPane.showMessageDialog(this, "Thank you!\nYour booking has
been successfully made");
new J1().setVisible(true);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(this, e.getMessage());
}
try{
Class.forName("com.mysql.jdbc.Driver");
Page
17
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/
hyatt","root","root");
Statement stmt=null;
stmt=con.createStatement();
String query="Update Room set avail='"+s1+"'where
rno='"+Room+"';";
int execute=stmt.executeUpdate(query);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
}
DefaultTableModel model=(DefaultTableModel)tab1.getModel();
String cb=cb1.getSelectedItem().toString();
try
Class.forName("java.sql.DriverManager");
Page
18
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/hyatt",
"root","root");
Statement stmt=(Statement)con.createStatement();
ResultSetrs=stmt.executeQuery(query);
int Found=0;
while(rs.next())
String roomno=rs.getString("rno");
String typ=rs.getString("rtype");
String avail=rs.getString("avail");
String cost=rs.getString("cost");
model.addRow(new Object[]{roomno,typ,avail,cost});
catch(Exception e)
Page
19
{
JOptionPane.showMessageDialog(cb1, "error");
if(tf_mob.getText().isEmpty())
else
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/blue_p
ark","root","root");
Statement stmt=null;
stmt=con.createStatement();
Page
20
ResultSe trs=null;
rs=stmt.executeQuery(q2);
if(rs.next()) {
bt1.setEnabled(true);
t1.setText(rs.getString("c_name"));
t3.setText(rs.getString("age"));
String temp_gender=rs.getString("gender");
if(temp_gender.equals("Male")){rb_male.setSelected(true);} else
{rb_female.setSelected(true);}
t2.setText(rs.getString("nps"));
t4.setText(rs.getString("contact_no"));
t5.setText(rs.getString("rnobile"));
t6.setText(rs.getString("cid"));
t7.setText(rs.getString("cod"));
cb2.setSelectedItem(rs.getString("id"));
} else {
Page
21
JOptionPane.showMessageDialog(null, "Sorry!\nThat was an incorrect mobile
number");
bt1.setEnabled(false);
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
bt1.setEnabled(false);
String gender="";
String Room=t5.getText();
String Name=t1.getText();
String Mobile=t4.getText();
String age=t3.getText();
String np=t2.getText();
String cid=t6.getText();
String ID=(cb2.getSelectedItem()).toString();
if(rb_male.isSelected())
Page
22
{
gender="Male";
else if(rb_female.isSelected())
gender="Female";
if(Name.isEmpty())
else if(age.isEmpty())
else if(np.isEmpty())
else if(Mobile.isEmpty())
else if(gender.isEmpty())
else if(Room.isEmpty())
else if(cid.isEmpty())
else {
try{Class.forName("com.mysql.jdbc.Driver");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/hyatt",
"root","root");
Statement stmt=null;
stmt=con.createStatement();
intqexecute=stmt.executeUpdate(query);
new J1().setVisible(true);
close();
catch (Exception e)
JOptionPane.showMessageDialog(this, e.getMessage());
}
Page
24
String s="yes";
String room=t5.getText();
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/hyatt",
"root","root");
Statement stmt=null;
stmt=con.createStatement();
int execute=stmt.executeUpdate(query);
catch (Exception e)
JOptionPane.showMessageDialog(this, e.getMessage());
String s1="No";
String rno=tt1.getText();
try{
Class.forName("com.mysql.jdbc.Driver");
Page
25
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/hyatt",
"root","root");
Statement stmt=null;
stmt=con.createStatement();
int execute=stmt.executeUpdate(query);
catch (Exception e)
JOptionPane.showMessageDialog(this, e.getMessage());
new J1().setVisible(true);
if(tf_mob.getText().isEmpty())
{
JOptionPane.showMessageDialog(null, "Please input a mobile number
first");
}
else
{
Page
26
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/hya
tt","root","root");
Statement stmt=null;
stmt=con.createStatement();
ResultSetrs=null;
String q2="Select * from cust where contact_no="+tf_mob.getText()+" limit
1;";
rs=stmt.executeQuery(q2);
if(rs.next()) {
bt_modify.setEnabled(true);
t1.setText(rs.getString("rno"));
tf_name.setText(rs.getString("c_name"));
tf_age.setText(rs.getString("age"));
tf_persons.setText(rs.getString("nps"));
tf_mobile.setText(rs.getString("contact_no"));
}
else
{
if(tf_mob.getText().isEmpty()){
JOptionPane.showMessageDialog(null, "Please input a mobile number
first");
} else {
int err=JOptionPane.showConfirmDialog(null, "Are you sure?\nYou want to
cancel the booking.");
if(err==0){
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/hya
tt","root","root");
Statement stmt=null;
stmt=con.createStatement();
String query="delete from cust where
contact_no="+tf_mob.getText()+";";
intqexecute=stmt.executeUpdate(query);
Page
28
JOptionPane.showMessageDialog(this, "The booking has been cancelled
successfully!");
bt_modify.setEnabled(false);
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
}
}
String s1="yes";
String Room=t1.getText();
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/hya
tt","root","root");
Statement stmt=null;
stmt=con.createStatement();
String query="Update Room set avail='"+s1+"'where rno='"+Room+"';";
int execute=stmt.executeUpdate(query);
}
catch (Exception e)
{
JOptionPane.showMessageDialog(this, e.getMessage());
}
Page
29
Source code for “Back”Button in “Cancel Booking page”form:
new J1().setVisible(true);
if(tf_mob.getText().isEmpty())
else
try{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/hyatt",
"root","root");
Statement stmt=null;
stmt=con.createStatement();
ResultSetrs=null;
rs=stmt.executeQuery(q2)
if(rs.next()) {
bt1.setEnabled(true);
t1.setText(rs.getString("c_name"));
Page
30
t4.setText(rs.getString("contact_no"));
t3.setText(rs.getString("rno"));
else
bt1.setEnabled(false);
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
bt1.setEnabled(false);
try
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/hyatt","root","root
");
Statement st=con.createStatement();
ResultSetrs=st.executeQuery(s);
while(rs.next())
Page
31
{
t5.setText(rs.getString("nd"));
catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
bt1.setEnabled(false);
try {
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/hyatt","root","root
");
Statement st=con.createStatement();
ResultSetrs=st.executeQuery(s);
while(rs.next())
t9.setText(rs.getString("cost"));
catch (Exception e) {
Page
32
JOptionPane.showMessageDialog(this, e.getMessage());
bt1.setEnabled(false);
double cost=Double.parseDouble(t9.getText());
doublends=Double.parseDouble(t5.getText());
doublegst=0.22*(cost*nds);
doubleamt=gst+(cost*nds);
t7.setText(Double.toString(amt));
t8.setText(Double.toString(gst));
String Room=t3.getText();
String Name=t1.getText();
String Mobile=t4.getText();
String nds=t5.getText();
String tcp=t7.getText();
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost/hya
tt","root","root");
Statement stmt=null;
Page
33
stmt=con.createStatement();
String query="INSERT INTO bill(c_name,contact_no,rno,days,tcost)
VALUES('"+Name+"', '"+Mobile+"', '"+Room+"', '"+nds+"',
'"+tcp+"');";
intqexecute=stmt.executeUpdate(query);
JOptionPane.showMessageDialog(this, "Thank you!\nYour transaction has
been successfully made");
new J5().setVisible(true);
}
catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
JOptionPane.showMessageDialog(this,"Thanks for visiting.\n "+"Please
visit us again.");
new J1().setVisible(true);
Page
34
OUTPUT SCREENS
For Login page:
Page
35
For Booking page:
Page
36
For Cancel Booking page:
Page
37
For Bill page:
Page
38
BIBLIOGRAPHY
Page
39