You are on page 1of 21

CERTIFICATE

This is hereby to certify that original and genuine work has been
carried to work on the matter and the related data collection and
investigation has been completed slowly, sincerely and
satisfactorily by Abhay Pratap Srivastava of class XII ‘MK’ of D.A.V
Public School BSEB Colony Patna-23 regarding his project title
“Hotel Management”

Teacher’s Signature

PLEASE ADD SCREENSHOT


ACKNOWLEDGEMENT

I am very thankful and expressing my deep sense of gratitude


towards MR. SADIQUE SIR, who inspired me to work on this topic.
I benefited a lot with discussing with them on this topic.
I am also thankful to my parents who provided me such an
opportunity, for their inspiring words.
I am also thankful to all my colleagues and all those who helped
me in completing this project.
Contents

Objectives of the project ........................................................................4


Features of Java: ....................................................................................... 6
INTRODUCTION TO MySQL ................................................................. 19
Screenshot of MySQL ........................................................................... 20
Bibliography ............................................................................................. 21
Objectives of The Project
The objective of the software project is to develop a
computerized system to ease the functions of a Hotel. This
software project is also aimed to enhance the current record
keeping system, which will help managers to retrieve the up-to-
date information at right time in right shape.

The proposed software system is expected to do the following


functionality-
To provide a user friendly, Graphical User Interface (GUI) based
integrated and centralized environment.
The proposed system should maintain all the records and should
generate the required reports and information when required.
To provide user-friendly interface to interact with a centralized
database based on client-server architecture.
In its current scope, the software enables user to retrieve and
update the information from centralized database designed with
MySQL. During the development of Hotel Management System
project, Java NetBeans IDE, a powerful, open source event-driven
form-based development environment is used for modular
design and future expandability of the system.
INTRODUCTION TO JAVA
Java is a computer programming language that is concurrent, class-
based, object-oriented, and specifically designed to have as few
implementation dependencies as possible. It is intended to let
application developers "write once, run anywhere" (WORA),
meaning that code that runs on one platform does not need to be
recompiled to run on another. Java applications are typically
compiled to bytecode that can run on any Java virtual machine (JVM)
regardless of computer architecture. Java is, as of 2015, one of the
most popular programming languages in use, particularly for client-
server web applications, with a reported 9 million developers.
Java was originally developed by James Gosling at Sun Microsystems
(which has since merged into Oracle Corporation) and released in
1995 as a core component of Sun Microsystems' Java platform. The
language derives much of its syntax from C and C++, but it has
fewer low-level facilities than either of them.
Features of Java:
1. Simple
2. Object-Oriented
3. Platform Independent
4. Secured
5. Robust
6. Open product
7. Portable
8. WORA (Write once Run anywhere)
 src Code for SIGN UP

import java.sql.*;
import javax.swing.JOptionPane;
Connection con;
PreparedStatement pstmt;
Statement stmt;
ResultSet rs;
public Sign_up() {
initComponents();
try
{
Class.forName("java.sql.Driver");

con=DriverManager.getConnection("jdbc:mysql://localhost/HOTEL_MANAGEMENT","
root","root");
stmt = con.createStatement();
}catch(Exception e1){}
}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {


try
{
pstmt = con.prepareStatement("insert SIGN_UP values ('"+t1.getText() + "','" +
t2.getText() + "','" + t3.getText() + "','" + t4.getText() + "','" + t5.getText() +
"','"+t6.getText()+"')");
pstmt.executeUpdate();
JOptionPane.showMessageDialog(this,
"success","MyDialog",JOptionPane.INFORMATION_MESSAGE );
new Login().show();
this.hide();
}catch(Exception e2s }

public static void main(String args[]) {


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Sign_up().setVisible(true);
}
});
}
Sign Up Screenshot!!!
 // src code for Login

import java.sql.*;
import javax.swing.JOptionPane;
public class Login extends javax.swing.JFrame {
Connection con;
PreparedStatement pstmt;
Statement stmt;
ResultSet rs;
public Login() {
initComponents();
try
{
Class.forName("java.sql.Driver");

con=DriverManager.getConnection("jdbc:mysql://localhost/HOTEL_MANAGEMENT","
root","root");
stmt = con.createStatement();
}catch(Exception e1){}
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try
{
ResultSet rs=stmt.executeQuery("select * from SIGN_UP where
LOGIN_ID='"+jTextField1.getText()+"'"+" and
PASSWORD='"+jPasswordField1.getText()+"'");
if(rs.next())new CUSTOMER_DETAILS().show();
else JOptionPane.showMessageDialog(this,
"Invalid.","MyDialog",JOptionPane.ERROR_MESSAGE );
}catch(Exception e2){}
}
Screenshot!!! LOGIN
 // src code for Room Detail
import java.sql.*;
import javax.swing.JOptionPane;
public class Room_DETAILS extends javax.swing.JFrame {
Connection con;
PreparedStatement pstmt;
Statement stmt;
ResultSet rs;
public Room_DETAILS() {
initComponents();
try
{
Class.forName("java.sql.Driver");

con=DriverManager.getConnection("jdbc:mysql://localhost/HOTEL_MANAGEMENT","
root","root");
stmt = con.createStatement();
}catch(Exception e1){}
}
)
private void t2ActionPerformed(java.awt.event.ActionEvent evt)
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try
{
pstmt = con.prepareStatement("insert ROOM_DETAILS values ('" + t1.getText() + "','"
+ t2.getSelectedItem() + "','" + t3.getSelectedItem() + "','" + t5.getText() + "','" +
t4.getSelectedItem() + "')");
pstmt.executeUpdate();
JOptionPane.showMessageDialog(this,
"success","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}catch(Exception e2){} // TODO add your handling code here:
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
try
{
pstmt = con.prepareStatement("update ROOM_DETAILS set ROOM TYPE = '" +
t2.getSelectedItem() + "', AC FACILITY = '" + t3.getSelectedItem() + "',ROOM FARE =
'"+t5.getText() + "' where ROOM_NO = '" + t1.getText() + "'" );
pstmt.executeUpdate();
JOptionPane.showMessageDialog(this,
"success","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}catch(Exception e2){}
}
Screenshot!!! Room details
 // src code for consumer detail

import java.sql.*;
import javax.swing.JOptionPane;
public class CUSTOMER_DETAILS extends javax.swing.JFrame {
Connection con;
PreparedStatement pstmt;
Statement stmt;
ResultSet rs;
public CUSTOMER_DETAILS() {
initComponents();
try
{
Class.forName("java.sql.Driver");

con=DriverManager.getConnection("jdbc:mysql://localhost/HOTEL_MANAGEMENT","
root","root");
stmt = con.createStatement();
}catch(Exception e1){}
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try
if(jTextField1.getText().length() == 0)
{
JOptionPane.showMessageDialog(this, "text field cannot left
blank","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else if(jTextField2.getText().length() == 0)
{
JOptionPane.showMessageDialog(this, "text field cannot left
blank","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else if(jTextArea1.getText().length() == 0)
{
JOptionPane.showMessageDialog(this, "text field cannot left
blank","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else if(jTextField3.getText().length() == 0)
{
JOptionPane.showMessageDialog(this, "text field cannot left
blank","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else if(jTextField4.getText().length() == 0)
{
JOptionPane.showMessageDialog(this, "text field cannot left
blank","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else if(jTextField5.getText().length() == 0)
{
JOptionPane.showMessageDialog(this, "text field cannot left
blank","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else if(jTextField6.getText().length() == 0)
{
JOptionPane.showMessageDialog(this, "text field cannot left
blank","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else if(jTextField3.getText().length() != 10)
{
JOptionPane.showMessageDialog(this, "MOBILE NO. IS
INVALID","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}
else
{
try
{
pstmt = con.prepareStatement("insert customer_details values
('"+jTextField1.getText() + "','" + jTextField2.getText() + "','" + jTextArea1.getText()
+"','" + jTextField3.getText() + "','" + jTextField4.getText() + "','" +
cb1.getSelectedItem()+"','"+ cb2.getSelectedItem()+ "','"+ jTextField5.getText()
+"','"+ jTextField6.getText()+ "')");
pstmt.executeUpdate();
JOptionPane.showMessageDialog(this,
"success","MyDialog",JOptionPane.INFORMATION_MESSAGE );
}

catch(Exception e2){}
}
}

private void jLabel9MouseClicked(java.awt.event.MouseEvent evt) {


new Room_DETAILS().show();
this.hide();
}
Screenshot Consumer details
INTRODUCTION TO MySQL
MySQL is (as of March 2014) the world's second most widely used
open-source relational database management system (RDBMS).
It is named after co-founder Michael Widenius's daughter, My.
The SQL phrase stands for Structured Query Language.

The MySQL development project has made its source code


available under the terms of the GNU General Public License, as
well as under a variety of proprietary agreements. MySQL was
owned and sponsored by a single for-profit firm, the Swedish
company MySQL AB, now owned by Oracle Corporation.

MySQL is a popular choice of database for use in web


applications, and is a central component of the widely used LAMP
open source web application software stack (and other 'AMP'
stacks). LAMP is an acronym for "Linux, Apache, MySQL,
Perl/PHP/Python." Free-software-open source projects that
require a full-featured database management system often use
MySQL.

MySQL is a query language that provide several DDL, DML, DCL


and TCL commands that helps us in feeding, manipulating,
updating the information stored in tabular form.
It allows us to store and retrieve inter-related information.
Connectivity is a tool that enables us to retrieve, update, delete
data from MySQL tables using java program.
Screenshot of MySQL
Bibliography

1. NetBeans IDE 7.1.2


2. Informatics Practises by Sumita Arora
3. www.icbse.com
4. www.wikipedia.org

You might also like