0% found this document useful (0 votes)
193 views78 pages

IP Project

This document provides information about a student project on India Airways for an Informatics Practices class. It includes a table of contents listing sections on front-end and back-end concepts, MySQL, NetBeans IDE, how the project works, database tables, sample outputs, and a bibliography. The project uses NetBeans as the front-end interface and MySQL as the backend database. It allows users to create an account, search for and book airline tickets.

Uploaded by

AmanSaxena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
193 views78 pages

IP Project

This document provides information about a student project on India Airways for an Informatics Practices class. It includes a table of contents listing sections on front-end and back-end concepts, MySQL, NetBeans IDE, how the project works, database tables, sample outputs, and a bibliography. The project uses NetBeans as the front-end interface and MySQL as the backend database. It allows users to create an account, search for and book airline tickets.

Uploaded by

AmanSaxena
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 78

Maheshwari Public School,

Pratap Nagar, Jaipur

AISSCE
(2015-2016)
Informatics Practices (065)

INDIA
AIRWAYS
Submitted by:
Submitted to:
Board Roll No:
Date of Submission:
Table of Contents
SNo. Contents Page No.
1. Preface 1
2. Acknowledgement 2
3. Certificate 3
4. Introduction to Front End and Back End Concept 4
5. Introduction to MySQL 7
6. Introduction to Netbeans IDE 12
7. Introduction to the working of Project Report 14
8. List of Tables included with their structure 56
9. Sample output of each form 59
10 Bibliography 71

PREFACE

This project report is based on the topic

"INDIA AIRWAYS". We have used NetBeansIDE 6.5.1 as Front end and

MySQL as Backend for the development of this application. This project

report is a part of class XII Informatics Practices Practical Examination.

This application has a facility to create his/her account from his/her

basic details. These details are stored in a table. Further he can search and

book airline tickets using his/her account.


I have gathered the information through books, internet, friends,

teachers and other resources to develop it and then learnt a lot while

developing it.

Name of Student

ACKNOWLEDGMENT

This project report based on the topic "INDIA AIRWAYSis a part of

AISSCE 2016 for Informatics Practices (065) Practical Examination.

We have worked on this project report as a group. There are many

people whom I want to thank who helped us for the development of this

report.
First and foremost I would like to thank our school management for

giving us such a well equipped and modern lab to learn all the basic and

advanced features of NetBeansIDE and MySQL.

I would also like to thank my parents and friends who helped me and the

Almighty God who gave me strength and inspiration in achieving this task.

Name of Student

CERTIFICATE

This is to certify that original and genuine project report is submitted by

________________bearing Roll No. _____________ for the accomplishment

of Informatics Practices (065) Final Practical Exam of AISSCE 2016. This

Project Report is prepared under the guidance and supervision of our


computer faculty during the session 2015-16. In this project report

NetBeans IDE is used as a Front End and MySQL is used as Back End.

Date: _______________________

External Examiner: _______________________

Internal Examiner: _______________________

Introduction to
Front End and Back End

Introduction
When you design real life applications, you are bound to
encounter situations wherein you need to manipulate data and
stored in a database through an application designed by you.
Since you are developing Java GUI applications using NetBeans
IDE, in this chapter our discussions will remain limited to in
order how to connect database in Java based application.
In Order to connect to a database
from within an application, you need a frame work that helps
you send and execute SQL statements from within the
application code. The most popular programming interface for
accessing relational database is ODBC (Open Database
Connectivity). But ODBC is Microsofts API which cannot be
directly been used in Java. If you want to connect a relational
database (e.g. MySQL or Oracle) from within Java you can do it
with JDBC (Java Database Connectivity) API of Java.
You may even use JDBC-ODBC connector i.e. JDBC layer over
ODBC but JDBC is better choice for accessing databases like
MySQL.

JDBC does mainly the following-


(i) Establish connection with a database.
(ii) Send SQL statements to database server.
(iii) Process the results obtained.

The Front End (GUI Application)

As we know that then programmers develop applications to


solve real life problems to simplify life of others. So, typing in
any number of inputs in applications carries a life span of one
execution only and when the application is executed second
Time, it requires a new set of inputs from the user. The data
entered by you in a front end application is getting stored in
temporary memory (RAM) and not getting saved on a hard disk
(on any other secondary storage device).

The Image shown is from NetBeans (front end).

The Back End (Database)

The database helps you to save data permanently in a secondary


storage devices and keep data ready for future reference,
modifications and additions. But you must have seen that to
perform these activities, you were required to learn SQL
commands CREATE, INSERT, UPDATE, DELTE, SELECT
and so on.. and each of these commands had their own syntax
structure.

The Image showing MySQL (back end) Command Line Client.

Introduction to MySQL
Any Enterprise depends a lot on proper functioning of data. The
data and information pertaining to different aspects of an
enterprise are very critical. Therefore, the enterprise needs some
sort of data management system top maintains and manipulate
all its data. The rising graph of DBMS (Database Management
System) popularity indicates such an importance of this system.
A DBMS not only store or maintains data, but also provide the
enterprises with centralized control of its operational data
especially sensitive and crucial data. There are many DBMSs
available in the market that ate capable of storing and maintain
the database of enterprises.
MySQL is a freely available open
source RDBMS (Relational Database Management System) that
uses Structured Query Language (SQL). It is down-loadable
from side www.mysql.org . In MySQL database, information is
stored in TABLES. A MySQL database contains many tables at
once and can store thousands of individual records. MySQL
provides you with a rich set of features that supports a square
environment for storing, maintaining and accessing data.
MySQL is a fast reliable, scalable, alternative to many of the
commercial RDBMSs available these days.

MySQL Database System


The key role of a database system is information management.
A database server is the key to solving the problems of
information management. In general, a server must reliably
manage a large amount of data in multi user environment so that
many users can concurrently access the same data. A database
server must also prevent unauthorized access and provide
efficient solutions of failure recovery. MySQL operates using
client/server architecture in which runs on the machine
containing the database and clients connect to server over a
network. The server operating systems is usually a Linux (like
Redhat 9.0 etc.), or windows operating system. MySQL typically
supported on Windows XP, Windows Server 2003, Red Hat
Fedora Linux, and Debian Linux, and others. MySQL is multi
user database system i.e. multiple users can access
simultaneously. Here :

The Server: MySQL server listens for client requests coming


in over the network and accesses database contents according to
those requests and provide that to clients.

Clients: Clients are the programs that connect to the database


server and issues queries in pre-specified format. MySQL is
compatible with the standard based SQL (Structured Query
Language).

Features of MySQL
Speed: If the server is optimal, MySQL runs very fast. It
supports clustered servers for demanding applications.
Ease of Use: MySQL is a high performance, relatively
simple database system.
Cost: MySQL is free of cost Open Source database.
MySQL is a part of LAMP (Linux, Apache, MySQL, PHP/
Perl /Python)
Query Language Support: MySQL understands
standards based SQL (Structured Query Language).
Portability: MySQL provides portability as it has been
tested or worked on many platforms.
Data Types: MySQL provides many data types to support
different types of data.
Security: MySQL offers a privilege and secure password
system that is very flexible, and it also provides host
verification system.
Scalability and Limits: MySQL can hold up to 50million
records, some up to have 60,000 tables and about
5,000,000,000 rows.
Connectivity: Clients can connect to server, using several
protocols.

How to Start MySQL?


1. Start > All Programs > MySQL > MySQL Server 5.1 >
MySQL Command Line Client.

2. Enter Password.

3. Type show databases;


4. Select a database e.g.use ipproject;.

5.Now you can add, modify create, update your database and
tables created in them.
Introduction to

NetBeans IDE
6.5.1
Introduction
Java is the popular 3rd generation programming language ,
which can be used to perform any of the 1000 of things that a
computer software can do. With the features it offers, Java has
become the language of choice for internet and intranet
applications. Java plays an important role for the proper
functioning of many software based devices attached to an
network. The kind of functionality the Java offers, has
contributed a lot towards the popularity of Java.
NetBeans IDE is a free open source cross
platform IDE (Integrated Development Environment) with built
in support for Java programming language. In fact NetBeans any
where there is Java Virtual Machine which runs on Java Byte
Code. It offers many features:
Drag and drop GUI creation
Excellent editing
Advanced source code editor
Web services
Excellent debugging
Wizards, code generation
Management tools

Visual Tour Of NetBeans


Before you start developing applications, make sure JavaSDK
(Java Software Development Kit) along with NetBeans IDE is
installed on NetBeans. You can download latest version of
NetBeans IDE 6.5.1 along with Java SDK from URL:
http://java.sun.com/javase/downloads/netbeans.html
After downloading install the software. The downloader will
install both JavaSDK and NetBeans for you. Once , installed
start NetBeans.
You can start NetBeans by
Start > All Programs > NetBeans > NetBeansIDE6.5.1
Forms Design with Their Codes
The following GUI Application is created to fasten up the rate of
online Airline booking. Application consists of 1 Project
containing 11 different forms.

FORM 1:

The form contain following components :


3 jLabel(s)
1 jTextField
1 jPasswordTextField
1 jPanel
3 jButton(s)
The application contains three action event handlers i.e.
jButton1[LOG IN](jPanel1) , jButton2[NEW USER](jPanel1)
and jButton3[EXIT](jPanel1).

Additional coding in the frame [LOGIN]


import java.sql.*;
import javax.swing.JOptionPane;

Code for jButton1 [LOG IN]:


String user=tuser.getText();
String pass=new String(tpass.getPassword());pass.isEmpty())
if ( user.isEmpty())
JOptionPane.showMessageDialog(null,"ENTER
USERNAME");
if ( pass.isEmpty())
JOptionPane.showMessageDialog(null,"ENTER
PASSWORD");
try
{ Class.forName("java.sql.DriverManager");
Connection con=DriverManager.getConnection
("jdbc:mysql://localhost:3306/ipproject","root","mps");
Statement stmt1=(Statement)con.createStatement();
String query1="select * from USERS where
USERNAME='"+user+"';";
ResultSet rs=stmt1.executeQuery(query1);
int flag=0;
while(rs.next())
{ flag=1;
String User=rs.getString("Username");
String Pass=rs.getString("Password");
if ( user.equals(User))
{ if ( pass.equals(Pass))
{ menu c = new menu();
this.setVisible(false);
c.setVisible(true); }
else
{ JOptionPane.showMessageDialog(null," WRONG
PASSWORD");}
}
}
if (flag<1)
JOptionPane.showMessageDialog(null,"WRONG/INVALID
USERNAME");
Statement stmt2=(Statement)con.createStatement();
String query2="delete from SELECTED;";
stmt2.executeUpdate(query2);
rs.close();
stmt1.close();
stmt2.close();
con.close();
}catch(Exception e)
{JOptionPane.showMessageDialog(this, e.getMessage());}

Code for jButton2 [NEW USER]:


newuser c = new newuser();
this.setVisible(false);
c.setVisible(true);

Code for jButton3 [EXIT]:


int reply=JOptionPane.showConfirmDialog(null,"Do you really
want to exit ? ");
if ( reply == 0)
System.exit(0);

FORM 2:

The form contain following components :


1 jPanel
4 jLabel(s)
2 jTextField(s)
1 jPasswordTextField
1 jComboBox
3 jButton(s)
The application contains three action event handlers i.e.
jButton1[SIGN UP](jPanel1) , jButton2[BACK](jPanel1) and
jButton3[EXIT](jPanel1).

Additional coding in the frame [NEW USER]


import java.sql.*;

Code for jButton1 [SIGN UP]:


String user=tuser.getText();
String pass=new String(tpass.getPassword());
int age=Integer.parseInt(tage.getText());
String prof=(String)cprof.getSelectedItem();
if(user.isEmpty())
JOptionPane.showMessageDialog(null,"ENTER
USERNAME");
if(pass.isEmpty())
JOptionPane.showMessageDialog(null,"ENTER
PASSWORD");
if(age==0)
JOptionPane.showMessageDialog(null,"ENTER YOUR AGE");
if(prof.isEmpty())
JOptionPane.showMessageDialog(null,"ENTER YOUR
PROFESSION");
try
{ Class.forName("java.sql.DriverManager");
Connection con = DriverManager.getConnection
("jdbc:mysql://localhost:3306/ipproject","root","mps");
Statement stmt=(Statement)con.createStatement();
String query="insert into USERS values
('"+user+"','"+pass+"','"+age+"','"+prof+"');";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog
(null, "YOU HAVE SUCESSFULLY SIGN UP");
login c = new login();
this.setVisible(false);
c.setVisible(true);
}catch(Exception e)
{JOptionPane.showMessageDialog(this, e.getMessage());}

Code for jButton2 [BACK]:


login c = new login();
this.setVisible(false);
c.setVisible(true);

Code for jButton3 [EXIT]:


int reply=JOptionPane.showConfirmDialog(null,"Do you really
want to exit ? ");
if ( reply == 0)
System.exit(0);

FORM 3:

The form contain following components :


5 jPanel(s)
5 jComboBox(s)
1 jButton
1 jLabel

The application contains two action event handlers i.e. cb1


(jPanel3)(jPanel2)(jPanel1) and jButton1 [SEARCH] (jPanel5)
(jPanel2)(jPanel1).
Additional coding in the frame [MENU]
import java.sql.*;
import javax.swing.JOptionPane;

Code for cb1:


Object sel=cb1.getSelectedItem();
Object i1=cb1.getItemAt(0);
Object i2=cb1.getItemAt(1);
Object i3=cb1.getItemAt(2);
Object i4=cb1.getItemAt(3);
Object i5=cb1.getItemAt(4);
cb2.removeAllItems();
cb2.addItem(i1);
cb2.addItem(i2);
cb2.addItem(i3);
cb2.addItem(i4);
cb2.addItem(i5);
cb2.removeItem(sel);

Code for jButton1 [SEARCH]:


String dp=(String) cb1.getSelectedItem();
String ar=(String) cb2.getSelectedItem();
String day=(String) cd.getSelectedItem();
String month=(String)cm.getSelectedItem();
String year=(String)cy.getSelectedItem();
try
{ Class.forName("java.sql.DriverManager");
Connection con=(Connection) DriverManager.getConnection
("jdbc:mysql://localhost:3306/ipproject","root","mps");
Statement stmt=(Statement) con.createStatement();
String query="insert into SELECTED
(DEPARTURE,ARRIVAL,DAY,MONTH,YEAR) values
('"+dp+"','"+ar+"',"+day+","+month+","+year+");";
stmt.executeUpdate(query);
stmt.close();
con.close();
} catch(Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage());}
search e = new search();
this.setVisible(false);
e.setVisible(true);

FORM 4:
The form contain following components

2 jPanel(s)
1 jScrollPane(Table)
1 jTextField
3 jButton
3 jLabel

The application contains three action event handlers i.e.


jButton1 [SEARCH FLIGHTS](jPanel1) , jButton2[GET
DETAILS](jPanel2)(jPanel1) and jButton3[BACK](jPanel1).
Additional coding in the frame [SEARCH]
import java.sql.*;
import javax.swing.JOptionPane;

Code for jButton1 [SEARCH FLIGHTS]:


DefaultTableModel model = (DefaultTableModel)
flights.getModel();
String dp="";
String ar="";
int day = 0;
int month = 0;
int year = 0;
try
{ Class.forName("java.sql.DriverManager");
Connection con=DriverManager.getConnection
("jdbc:mysql://localhost:3306/ipproject","root","mps");
Statement stmt1=(Statement)con.createStatement();
String query1="Select * from SELECTED;";
ResultSet rs1=stmt1.executeQuery(query1);
while(rs1.next())
{ dp=rs1.getString(3);
ar=rs1.getString(4);
day=rs1.getInt(5);
month=rs1.getInt(6);
year=rs1.getInt(7);
}
String date=year+"-"+month+"-"+day;
Statement stmt2=(Statement)con.createStatement();
String query2="Select dayofweek('"+date+"');";
ResultSet rs2=stmt2.executeQuery(query2);
while(rs2.next())
{ int date_int=rs2.getInt(1);
switch (date_int)
{ case 1:date="SUNDAY";
break;
case 2:date="MONDAY";
break;
case 3:date="TUESDAY";
break;
case 4:date="WEDNESDAY";
break;
case 5:date="THURESDAY";
break;
case 6:date="FRIDAY";
break;
case 7:date="SATURDAY";
break;
}
}
Statement stmt3=(Statement)con.createStatement();
String query3="select * from FLIGHTS where
day='"+date+"'&& departure='"+dp+"'&& arrival='"+ar+"';";
ResultSet rs3=stmt3.executeQuery(query3);
while(rs3.next())
{ String flightno=rs3.getString(1);
String dtime=rs3.getString(4);
String atime=rs3.getString(5);
String price=rs3.getString(9);
model.addRow (new Object[] {flightno,dtime,atime,price});
tdf.setText(""+flightno);
}
}catch(Exception e)
{JOptionPane.showMessageDialog(null, e.getMessage());}

Code for jButton2 [GET DETAILS]:


String selflg=(String) tdf.getText();
try {
Class.forName("java.sql.DriverManager");
Connection con=(Connection) DriverManager.getConnection
("jdbc:mysql://localhost:3306/ipproject","root","mps");
Statement stmt=(Statement) con.createStatement();
String query="update SELECTED set FLIGHTNO=
'"+selflg+"';";
stmt.executeUpdate(query);
stmt.close();
con.close();
}catch(Exception e)
{JOptionPane.showMessageDialog(null, e.getMessage());}
details e = new details();
this.setVisible(false);
e.setVisible(true);

Code for jButton3 [BACK]:


menu e = new menu();
this.setVisible(false);
e.setVisible(true);

FORM 5:
The form contain following components

1 jPanel
2 jButton(s)
16 jLabel(s)

The application contains three action event handlers i.e.


MouseEntered, jButton1 [BOOK SEAT](jPanel1) and
jButton2[BACK](jPanel1).
Additional coding in the frame [DETAILS]
import java.sql.*;
import javax.swing.JOptionPane;

Code for MouseEntered:


String flightno="";
String departure="";
String arrival="";
String dtime="";
String atime="";
String seats="";
String price="";
try
{ Class.forName("java.sql.DriverManager");
Connection con=DriverManager.getConnection
("jdbc:mysql://localhost:3306/ipproject","root","mps");
Statement stmt1=(Statement)con.createStatement();
String query1="select * from SELECTED;";
ResultSet rs1=stmt1.executeQuery(query1);
while(rs1.next())
{ flightno=rs1.getString(1);}
Statement stmt2=(Statement)con.createStatement();
String query2="select * from FLIGHTS where FLIGHTNO
='"+flightno+"';";
ResultSet rs2=stmt2.executeQuery(query2);
while(rs2.next())
{ flightno=rs2.getString(1);
departure=rs2.getString(2);
arrival=rs2.getString(3);
dtime=rs2.getString(4);
atime=rs2.getString(5);
seats=rs2.getString(7);
price=rs2.getString(9);
}
}catch(Exception e)
{JOptionPane.showMessageDialog(null, e.getMessage());}
lfn.setText(""+flightno);
lpd.setText(""+departure);
lpa.setText(""+arrival);
ltd.setText(""+dtime);
lta.setText(""+atime);
lns.setText(""+seats);
lps.setText(""+price);
Code for jButton1 [BOOK SEATS]:
int reply=JOptionPane.showConfirmDialog(null,"DO YOU
REALLY WANT TO BOOK SEAT ? ")
if ( reply == 0)
{ book c = new book();
this.setVisible(false);
c.setVisible(true);
}

Code for jButton2 [BACK]:


search c = new search();
this.setVisible(false);
c.setVisible(true);

FORM 6:
The form contain following components

2 jPanel
6 jLabel(s)
3 jTextField(s)
1 jPasswordField
2 jComboBox(s)
2 jButton(s)

The application contains three action event handlers i.e.


WindowOpened, jButton1[CALCULATE PAY AMOUNT]
(jPanel1) and jButton2[PAY AMOUNT](jPanel2)(jPanel1).
Additional coding in the frame [BOOK]
import java.sql.*;

Code for WindowOpened:


jPanel2.setVisible(false);

Code for jButton1 [CALCULATE PAY AMOUNT]:


int seat=js.getSelectedIndex();
int seats=seat+1;
String flightno="";
double amount=0;
double price=0;
try
{ Class.forName("java.sql.DriverManager");
Connection con=DriverManager.getConnection
("jdbc:mysql://localhost:3306/ipproject","root","mps");
Statement stmt1=(Statement)con.createStatement();
String query1="select * from SELECTED;";
ResultSet rs1=stmt1.executeQuery(query1);
while (rs1.next())
{ flightno =rs1.getString(1);}
Statement stmt2=(Statement)con.createStatement();
String query2="select * from FLIGHTS where FLIGHTNO=
'"+flightno+"';";
ResultSet rs2=stmt2.executeQuery(query2);
while(rs2.next())
{ price=rs2.getDouble(9);}
amount=(seats*price);
tpa.setText(""+amount);

Statement stmt3=(Statement)con.createStatement();
String query3="update SELECTED set SEATS_REQ =
'"+seats+"';";
stmt3.executeUpdate(query3);
}catch(Exception e)
{JOptionPane.showMessageDialog(this, e.getMessage());}
jPanel2.setVisible(true);

Code for jButton2 [PAY AMMOUNT]:


String bank=new String(tb.getText());
String acc=new String(tac.getText());
String pass=new String(tpass.getPassword());
if(bank.isEmpty())
JOptionPane.showMessageDialog(null,"ENTER BAMK
NAME");
if(acc.isEmpty())
JOptionPane.showMessageDialog(null,"PLEASE ENTER
ACCOUNT NUMBER");
if(pass.isEmpty())
JOptionPane.showMessageDialog(null,"PLEASE ENTER
PASSWORD");
else
{JOptionPane.showMessageDialog(null,"THE TRANSATION
HAS BEEN SUCESSFULLY COMELETED");
JOptionPane.showMessageDialog(null,"THANK YOU USING
OUR SITE");}
if(seats==1)
{ticket1 c = new ticket1();
this.setVisible(false);
c.setVisible(true);}
if(seats==2)
{ticket2 c = new ticket2();
this.setVisible(false);
c.setVisible(true);}
if(seats==3)
{ticket3 c = new ticket3();
this.setVisible(false);
c.setVisible(true);}
if(seats==4)
{ticket4 c = new ticket4();
this.setVisible(false);
c.setVisible(true);}
if(seats==5)
{ticket5 c = new ticket5();
this.setVisible(false);
c.setVisible(true);}
FORM 7:

The form contain following components


3 jPanel
1 jLabel(s)
2 jTextField(s)
2 jButton(s)

The application contains two action event handlers i.e.


jButton1[GENERATE TICKET] (jPanel2)(jPanel1) and
jButton2[BACK TO MENU](jPanel1).
Additional coding in the frame [TICKET1]
import java.sql.*;
import javax.swing.JOptionPane;

Code for jButton1 [GENERATE TICKET]:


int seatsreq=0;
int seats=0;
int lseat=0;
String flightno="";
try
{ Class.forName("java.sql.DriverManager");
Connection con=DriverManager.getConnection
("jdbc:mysql://localhost:3306/ipproject","root","mps");
Statement stmt1=(Statement)con.createStatement();
String query1="select * from SELECTED;";
ResultSet rs1=stmt1.executeQuery(query1);
while(rs1.next())
{ flightno=rs1.getString(1);
seatsreq=rs1.getInt(2);}
Statement stmt2=(Statement)con.createStatement();
String query2="select * from FLIGHTS where FLIGHTNO=
'"+flightno+"';";
ResultSet rs2=stmt2.executeQuery(query2);
while(rs2.next())
{seats=rs2.getInt(7);
lseat=rs2.getInt(8);}

int i;
for(i=lseat+1;i<=(lseat+seatsreq);i++)
{ tf.setText(""+i);}
seats=seats-seatsreq;
lseat=i-1;
Statement stmt3=(Statement)con.createStatement();
String query3="update FLIGHTS set SEATS='"+seats+"'
where FLIGHTNO='"+flightno+"';";
stmt3.executeUpdate(query3);

Statement stmt4=(Statement)con.createStatement();
String query4="update FLIGHTS set LAST_SEAT=
'"+lseat+"' where FLIGHTNO='"+flightno+"';";
stmt4.executeUpdate(query4);
}catch(Exception e)
{JOptionPane.showMessageDialog(this, e.getMessage());}

Code for jButton2 [BACK TO MENU]:


menu c = new menu();
this.setVisible(false);
c.setVisible(true);

FORM 8:

The form contain following components


3 jPanel
2 jLabel(s)
2 jTextField(s)
1 jTextArea
2 jButton(s)

The application contains two action event handlers i.e.


jButton1[GENERATE TICKET] (jPanel2)(jPanel1) and
jButton2[BACK TO MENU](jPanel1).
Additional coding in the frame [TICKET2]
import java.sql.*;
import javax.swing.JOptionPane;

Code for jButton1 [GENERATE TICKET]:


int seatsreq=0;
int seats=0;
int lseat=0;
String flightno="";
try
{ Class.forName("java.sql.DriverManager");
Connection con=DriverManager.getConnection
("jdbc:mysql://localhost:3306/ipproject","root","mps");
Statement stmt1=(Statement)con.createStatement();
String query1="select * from SELECTED;";
ResultSet rs1=stmt1.executeQuery(query1);
while(rs1.next())
{ flightno=rs1.getString(1);
seatsreq=rs1.getInt(2);}
Statement stmt2=(Statement)con.createStatement();
String query2="select * from FLIGHTS where FLIGHTNO=
'"+flightno+"';";
ResultSet rs2=stmt2.executeQuery(query2);
while(rs2.next())
{seats=rs2.getInt(7);
lseat=rs2.getInt(8);}

int i;
for(i=lseat+1;i<=(lseat+seatsreq);i++)
{ ta.append(",");
ta.append(""+i);}
seats=seats-seatsreq;
lseat=i-1;
Statement stmt3=(Statement)con.createStatement();
String query3="update FLIGHTS set SEATS='"+seats+"'
where FLIGHTNO='"+flightno+"';";
stmt3.executeUpdate(query3);

Statement stmt4=(Statement)con.createStatement();
String query4="update FLIGHTS set LAST_SEAT=
'"+lseat+"' where FLIGHTNO='"+flightno+"';";
stmt4.executeUpdate(query4);
}catch(Exception e)
{JOptionPane.showMessageDialog(this, e.getMessage());}

Code for jButton2 [BACK TO MENU]:


menu c = new menu();
this.setVisible(false);
c.setVisible(true);
FORM 9:

The form contain following components


3 jPanel
3 jLabel(s)
3 jTextField(s)
1 jTextArea
2 jButton(s)

The application contains two action event handlers i.e.


jButton1[GENERATE TICKET] (jPanel2)(jPanel1) and
jButton2[BACK TO MENU](jPanel1).
Additional coding in the frame [TICKET3]
import java.sql.*;
import javax.swing.JOptionPane;

Code for jButton1 [GENERATE TICKET]:


int seatsreq=0;
int seats=0;
int lseat=0;
String flightno="";
try
{ Class.forName("java.sql.DriverManager");
Connection con=DriverManager.getConnection
("jdbc:mysql://localhost:3306/ipproject","root","mps");
Statement stmt1=(Statement)con.createStatement();
String query1="select * from SELECTED;";
ResultSet rs1=stmt1.executeQuery(query1);
while(rs1.next())
{ flightno=rs1.getString(1);
seatsreq=rs1.getInt(2);}
Statement stmt2=(Statement)con.createStatement();
String query2="select * from FLIGHTS where FLIGHTNO=
'"+flightno+"';";
ResultSet rs2=stmt2.executeQuery(query2);
while(rs2.next())
{seats=rs2.getInt(7);
lseat=rs2.getInt(8);}

int i;
for(i=lseat+1;i<=(lseat+seatsreq);i++)
{ ta.append(",");
ta.append(""+i);}
seats=seats-seatsreq;
lseat=i-1;
Statement stmt3=(Statement)con.createStatement();
String query3="update FLIGHTS set SEATS='"+seats+"'
where FLIGHTNO='"+flightno+"';";
stmt3.executeUpdate(query3);

Statement stmt4=(Statement)con.createStatement();
String query4="update FLIGHTS set LAST_SEAT=
'"+lseat+"' where FLIGHTNO='"+flightno+"';";
stmt4.executeUpdate(query4);
}catch(Exception e)
{JOptionPane.showMessageDialog(this, e.getMessage());}

Code for jButton2 [BACK TO MENU]:


menu c = new menu();
this.setVisible(false);
c.setVisible(true);
FORM 10:
The form contain following components

3 jPanel
4 jLabel(s)
4 jTextField(s)
1 jTextArea
2 jButton(s)

The application contains two action event handlers i.e.


jButton1[GENERATE TICKET] (jPanel2)(jPanel1) and
jButton2[BACK TO MENU](jPanel1).
Additional coding in the frame [TICKET4]
import java.sql.*;
import javax.swing.JOptionPane;

Code for jButton1 [GENERATE TICKET]:


int seatsreq=0;
int seats=0;
int lseat=0;
String flightno="";
try
{ Class.forName("java.sql.DriverManager");
Connection con=DriverManager.getConnection
("jdbc:mysql://localhost:3306/ipproject","root","mps");
Statement stmt1=(Statement)con.createStatement();
String query1="select * from SELECTED;";
ResultSet rs1=stmt1.executeQuery(query1);
while(rs1.next())
{ flightno=rs1.getString(1);
seatsreq=rs1.getInt(2);}
Statement stmt2=(Statement)con.createStatement();
String query2="select * from FLIGHTS where FLIGHTNO=
'"+flightno+"';";
ResultSet rs2=stmt2.executeQuery(query2);
while(rs2.next())
{seats=rs2.getInt(7);
lseat=rs2.getInt(8);}

int i;
for(i=lseat+1;i<=(lseat+seatsreq);i++)
{ ta.append(",");
ta.append(""+i);}
seats=seats-seatsreq;
lseat=i-1;
Statement stmt3=(Statement)con.createStatement();
String query3="update FLIGHTS set SEATS='"+seats+"'
where FLIGHTNO='"+flightno+"';";
stmt3.executeUpdate(query3);

Statement stmt4=(Statement)con.createStatement();
String query4="update FLIGHTS set LAST_SEAT=
'"+lseat+"' where FLIGHTNO='"+flightno+"';";
stmt4.executeUpdate(query4);
}catch(Exception e)
{JOptionPane.showMessageDialog(this, e.getMessage());}

Code for jButton2 [BACK TO MENU]:


menu c = new menu();
this.setVisible(false);
c.setVisible(true);

FORM 11:
The form contain following components

3 jPanel
5 jLabel(s)
5 jTextField(s)
1 jTextArea
2 jButton(s)
The application contains two action event handlers i.e.
jButton1[GENERATE TICKET] (jPanel2)(jPanel1) and
jButton2[BACK TO MENU](jPanel1).
Additional coding in the frame [TICKET5]
import java.sql.*;
import javax.swing.JOptionPane;

Code for jButton1 [GENERATE TICKET]:


int seatsreq=0;
int seats=0;
int lseat=0;
String flightno="";
try
{ Class.forName("java.sql.DriverManager");
Connection con=DriverManager.getConnection
("jdbc:mysql://localhost:3306/ipproject","root","mps");
Statement stmt1=(Statement)con.createStatement();
String query1="select * from SELECTED;";
ResultSet rs1=stmt1.executeQuery(query1);
while(rs1.next())
{ flightno=rs1.getString(1);
seatsreq=rs1.getInt(2);}
Statement stmt2=(Statement)con.createStatement();
String query2="select * from FLIGHTS where FLIGHTNO=
'"+flightno+"';";
ResultSet rs2=stmt2.executeQuery(query2);
while(rs2.next())
{seats=rs2.getInt(7);
lseat=rs2.getInt(8);}

int i;
for(i=lseat+1;i<=(lseat+seatsreq);i++)
{ ta.append(",");
ta.append(""+i);}
seats=seats-seatsreq;
lseat=i-1;
Statement stmt3=(Statement)con.createStatement();
String query3="update FLIGHTS set SEATS='"+seats+"'
where FLIGHTNO='"+flightno+"';";
stmt3.executeUpdate(query3);
Statement stmt4=(Statement)con.createStatement();
String query4="update FLIGHTS set LAST_SEAT=
'"+lseat+"' where FLIGHTNO='"+flightno+"';";
stmt4.executeUpdate(query4);
}catch(Exception e)
{JOptionPane.showMessageDialog(this, e.getMessage());}

Code for jButton2 [BACK TO MENU]:


menu c = new menu();
this.setVisible(false);
c.setVisible(true);
MYSQL Tables with Their Structures
DATABASE NAME : ipproject

TABLE 1: USERS
TABLE 2: FLIGHTS
TABLE 3:SELECTED
PROJECT OUTPUT:

After input Name:


If Wrong/Invalid Username:

If Wrong Password:
If New User:

After Entering Values:

After SignUp & Login:


After Search:
After Search Filghts:
After Get Details:
After Mouse Entered:

After Book Seats:


After Calculate Amount:

If Bank Name not Entered:


If Account Number not Entered:
After Pay Amount and Seat required is 1:

After Pay Amount and Seat required is 2:


After Pay Amount and Seat required is 3:

After Pay Amount and Seat required is 4:


After Pay Amount and Seat required is 5:
BIBLIOGRAPHY
SUMITA ARORA CLASS 12

SUMITA ARORA CLASS 11

NCERT INFORMATIC PRACTICES CLASS 12

NCERT INFORMATIC PRACTICES CLASS 11

You might also like