Sunteți pe pagina 1din 39

A MINI PROJECT REPORT

ON

FOR
AISSCE 2018- 2019 EXAMINATION
As a part of the Informatics Practices Course (065)

SUBMITTED BY:

Name of the Student


1)

Under the guidance of

DEPARTMENT OF COMPUTER SCIENCE

SRI CHAITANYA TECHNO SCHOOL

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

Name of Database for this project: HYATT

Tables created for this project:

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

Source code for “Login ” Button in “Login page” form:

String u,p;

u=jTextField1.getText();

p=jPasswordField1.getText();

if(u.equalsIgnoreCase("e01") &&p.equalsIgnoreCase("password"))

new J1().setVisible(true);

else{

JOptionPane.showMessageDialog(this,"Please Check Your Password And


Username");

Source code for “Add” Button in “Info page” form:

new J4().setVisible(true);

Source code for “Delete”Button in “Info page” form:


Page
14
new J7().setVisible(true);

Source code for “Modify”Button in “Info page” form:

new J6().setVisible(true);

Source code for “Bill”Button in “Info page” form:

new J9().setVisible(true);

Source code for “Cancel”Button in “Info page” form:

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

Source code for “Find”Button in “Booking page” form:

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

String query="SELECT rno,rtype,avail,cost from room WHERE


rtype='"+cb+"';";

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

Source code for “Fetch”Button in “Modify page” form:

if(tf_mob.getText().isEmpty())

JOptionPane.showMessageDialog(null, "Please input a mobile number first");

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;

String q2="Select * from cust where contact_no="+tf_mob.getText()+" limit


1;";

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

Source code for “Update”Button in “Modify page”form:

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 cod =t7.getText();

String ID=(cb2.getSelectedItem()).toString();

if(rb_male.isSelected())
Page
22
{

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


Page
23
else if(cod.isEmpty())

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="Update cust set c_name='"+Name+"', nps='"+np+"',


age='"+age+"', contact_no='"+Mobile+"',gender='"+gender+"',
rno='"+Room+"',cid='"+cid+"', cod='"+cod+"', id='"+ID+"';";

intqexecute=stmt.executeUpdate(query);

JOptionPane.showMessageDialog(this, "Thank you!\nYour Booking has been


modified");

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

String query="Update Room set avail='"+s+"'whererno='"+room+"';";

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

String query="Update Room set avail='"+s1+"'where rno='"+rno+"';";

int execute=stmt.executeUpdate(query);

catch (Exception e)

JOptionPane.showMessageDialog(this, e.getMessage());

Source code for “Back”Button in “Modify page”form:

new J1().setVisible(true);

Source code for “Fetch”Button in “Cancel Booking page”form:

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
{

JOptionPane.showMessageDialog(null, "Sorry!\nThat was an incorrect


mobile number");
Page
27
bt_modify.setEnabled(false);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
bt_modify.setEnabled(false);
}
}

Source code for “Cancel”Button in “Cancel Booking page”form:

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

Source code for “Fetch”Button in “Billpage”form:

if(tf_mob.getText().isEmpty())

JOptionPane.showMessageDialog(null, "Please input a mobile number first");

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;

String q2="Select * from cust where contact_no="+tf_mob.getText()+"


limit 1;";

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

JOptionPane.showMessageDialog(null, "Sorry!\nThat was an incorrect mobile


number");

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

String s="Select(dayofmonth(cod)-dayofmonth(cid)) as nd from cust ;";

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

String s="Select cost from room ;";

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

Source code for “Save Records”Button in “Bill page”form:

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

Source code for “Main Menu”Button in “Bill page”form:

new J1().setVisible(true);

Page
34
OUTPUT SCREENS
For Login page:

For Option page:

Page
35
For Booking page:

For Modify page

Page
36
For Cancel Booking page:

Page
37
For Bill page:

Page
38
BIBLIOGRAPHY

 Informatics Practices NCERT textbook


 Informatics Practices SUMITA ARORA textbook
URL references:
 www.google.co.in

Page
39

S-ar putea să vă placă și