You are on page 1of 42

INFORMATICS PRACTICES

PROJECT FILE
(SESSION 2016 2017)

AIRLINE RESERVATION
SYSTEM

SUBMITTED TO:Mrs. Vandana Thakur


PROJECT BY:Sarthak Gupta

Page 2

About the project .... 5


Acknowledgements ... 6
System requirements.. 7
Introduction.. 8
Flowchart.. 10
Design and coding.. 15
Main form... 16
User login.... 18
Signup form... 20
Booking form. 24
Seat selection form... 29
Payment form... 32
Reservation form. 34
Admin login form. 37
Validation form.... 39
Bibliography....42

Page 3

Page 4

The GUI application is based upon the simple and


basic idea of how online flight ticket booking system
works . The main objective of this project is to reduce
the time wasted in standing in lines and booking
tickets as well as reduce the chances that are made
in the manual works done at the booking ports , but
this project is an initiative to ignore any chance of
error as well as save time and promote the simplicity
of online works today. It is a lot much time saving as
such systems responds to users quick enough making
things much easier. This is a user friendly GUI and
can be used to book a flight ranging any distance
in less than a while. The system keeps the check on
user inputs and every other detail he/she gives thereby
suppressing

chances of irrelevancy as well.

The project has been coded and designed in


NetBeans IDE 8.0.2 and many photo editors have
also been used such as Adobe Photoshop CS-6 and
many more suiting the situation and backgrounds
have been downloaded from www. Shutterstock.com

Page 5

I world like to express my greatest gratitude to the


people who have helped and supported me throughout
my project . I am grateful to my teacher , Mrs. Vandana
, for her continuous support for the project , from
initial advice and contacts in the early stages
conceptual inception and through ongoing advice and
encouragement to this day.

I wish to thank my parents for their individual


support and interest, who inspired me and encouraged
me to go my own way , without whom I would not
have been able to complete the project.

At last but not the least , a special thanks of mine


goes to my friends who helped me in completing the
project through their thoughts and made this project
easy and accurate. I would also like to thanks my
friends who appreciated me for my work and
motivated me and finally to God who made all
things possible.

Page 6

Minimum Hardware Requirements

Microsoft Windows XP/Vista Sp1/ Windows 7 Professional:


Processor: 600MHZ Intel Pentium IV or equivalent
Memory: 512 MB
Disk Space : 300 MB of free

Ubuntu 9.10:
Processor: 600 MHZ Intel Pentium IV or equivalent
Memory : 512 MB
Disk Space: 250MB of free disk space

Solaris OS v ersion 11 Express (x86/x64 Platform Edition)

Processor: AMD Opteron 1200 series 1.8 GHZ


Memory : 512 MB
Disk Space: 275 MB

Macintosh OS X 10.6 Intel:


Processor : Dual-Core Intel(32 or 64-bit)
Memory : 1 GB
Disk Space: 300Mb of free disk space

Page 7

Many people are travelling with airplanes, either on means of


daily to and from work or on some vacation , to mention a
few. To much reservations for such travels, airline companies
hold for a user to book a travel himself. A functionality which
these websites lacks out on, is the option for the user to set up
specific requirements for the travel such as , minimal travel
time

and distance .

Based on the methods provided by Object Oriented


Programming the report will
Another aspect of the

present

a result to such problems.

will be to have an easy to use Interface

which makes it easier for less computer experienced users to use


as well. The functionalities given to users can be judged
through this Figure :

Page 8

Whereas the Administrator has functionalities as shown:

To form the overview of what the system should interact with,


a rich picture has been made and described.

Page 9

Page
10

START

Accept
YES

If choice
= login

choice

No

If choice
= signup

OPEN
USER LOGIN
FORM

No

OPEN
ADMIN LOGIN
FORM

No
Accept
Information

(If correct)

If choice
=admin

OPEN
Signup
form

No

Accept
login
details

No

Accept
login
details

(If correct)

Stores Information

OPEN
Validation
form

Store Data
Page
11

OPEN BOOKING
SYSTEM FORM

ACCEPT
FLIGHT
DETAILS

If choice =
Domestic

If choice =
International

VIEW FLIGHTS DETAILS


ACCORDINGLY
DESIRED

VIEW FLIGHTS DETAILS


ACCORDINGLY
DESIRED

ACCEPT
FLIGHT

ACCEPT
FLIGHT

OPEN SEAT SELECTION


FORM

B
Page
12

Accept
passengers

Accept
class

If choice =
First

If choice =
Economy

Select seat from


Economy class seat
list

Select seat from


First class seat list.

OPEN
PAYMENT WINDOW

C
Page
13

ACCEPT
CHOICE

If choice =
VisaCard

If choice
= Paypal

OPEN FINAL DETAILS

RESERVE FLIGHT

STOP

Page
14

If choice =
MasterCard

There are 10 forms in total :-

1.

Main Form

2.

Login Form

3.

Signup Form

4.
5.

Flights Booking Form


Seat Booking Form

6.

Payment Selection Form

7.

Reservation Form

8.

Admin Login Form

9.

Flight tracking Form

10. Flights Validation Form

Page
15

FORM SUMMARY :The above form is the main window of the application
which provides every user with three choices.
The person can login into the system by registering
himself by clicking SIGNUP and then LOGIN anytime from
anywhere he/she desires.
NOTE :- The idea of ADMIN is to refer to the regular validation of the flights
and other required information that needs to be kept fresh that can be done by
administrators . It is not meant for normal users.

Page
16

private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt)


{
new AIR_RESERVATION_SYSTEM().setVisible(true);
dispose();

private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt)


{
new NewJFrame().setVisible(true);
dispose();

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


{
String d = JOptionPane.showInputDialog(this,"ENTER UNIQUE CODE");
if ((d != null) && (d.length() > 0))
{
Try
{
new FLIGHT_DETAILS().setVisible(true);
dispose();
rs2 = st1.executeQuery("select * from reserved where uni = '"+d+"'");
}
catch (SQLException ex)
{
Logger.getLogger(mai.class.getName()).log(Level.SEVERE, null, ex);
}
FLIGHT_DETAILS.jTable2.setModel(DbUtils.resultSetToTableModel(rs2));

Page
17

FORM SUMMARY :This is the window that opens when the user clicks on
login button . the user is prompted to enter his/her
username and password which on being correct prompts
the user to further window which is the Booking Form.

Page
18

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


{
int c = 0;String sql=" Select * from skyline_users";
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con= (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql","root","");
Statement stmt = (Statement) con.createStatement();
Statement stmt1 = (Statement) con.createStatement();
ResultSet rs = stmt.executeQuery(sql);
String user=jTextField1.getText();
String pwd= new String (jPasswordField1.getPassword());
while(rs.next()) {
String uname=rs.getString("email");
String password=rs.getString("password");
if ((user.equals(uname)) && (pwd.equals(password)))
{ c=1;
rs1=stmt1.executeQuery("select * from skyline_users where email='"+user+"' ");
while(rs1.next()){
name = rs1.getString("name");
mob=rs1.getString("mobile");
}
new MANAGING_SOFTWARE().setVisible(true);
dispose();
}
}
if(c==0)
{System.exit(0);}
}
catch (Exception e){
JOptionPane.showMessageDialog(this, e.getMessage());

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


System.exit(0);

Page
19

Form Summary:This is the form/window which opens when the user clicks
on the SIGNUP window on the main form. This form accepts
all essential information from the user and stores them in
the database thereby registering the user in the system.

Page
20

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


{
String name = jTextField1.getText();
String email = jTextField2.getText();
String password = jPasswordField1.getText();
String mobile = (jTextField4.getText());
String cor = jTextField5.getText();
String mn = jTextField3.getText();
String date = jTextField7.getText() +"/"+jTextField8.getText() +"/"+jTextField9.getText();
int d = Integer.parseInt(jTextField7.getText());
int m = Integer.parseInt(jTextField8.getText());
int y = Integer.parseInt(jTextField9.getText());
int c = 0 ;
if(m==1||m==3||m==5||m==7||m==8||m==10||m==12)
{
if(d<=0||d>31)
c=1;
}
else if(m==4||m==6||m==9||m==11)
{
if(d<=0||d>30)
c=1;
}
else if(m==2)
{
if(y%4==0 && d<=0||d>29)
c=1;
}
else if(y%4!=0 && d<=0||d>28)
c=1;
if(Integer.toString(y).length()!=4)
{ c=1;}
if(m>12)
{c=1;}
if (c==1)
{
JOptionPane.showMessageDialog(this,"INVALID DATE");
}
else
if(name.isEmpty()||email.isEmpty()||password.isEmpty()||mobile.isEmpty()||cor.isEmpty())
Page
21

{
JOptionPane.showMessageDialog(this,"Information incomplete");
}
else if(mobile.length()!=10)
{
JOptionPane.showMessageDialog(this,"wrong mobile no.");
}
else if(jCheckBox1.isSelected()!= true)
{
JOptionPane.showMessageDialog(this,"Please agree to our terms and conditions ");
}
else
{
try
{
Class.forName("java.sql.DriverManager");
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql", "root","");
Statement stmt = (Statement) con.createStatement();
Statement st = (Statement) con.createStatement();
String query="INSERT INTO skyline_users VALUES
('"+name+"','"+email+"','"+password+"','"+date+"','"+cor+"','"+mobile+"','"+mn+"');";
stmt.executeUpdate(query);
}
catch (Exception e)
{
JOptionPane.showMessageDialog (this, e.getMessage());
}
}

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


try {
new mai().setVisible(true);
} catch (SQLException ex) {
Logger.getLogger(NewJFrame.class.getName()).log(Level.SEVERE, null, ex);
}
dispose();

Page
22

After signing up the information gets stored in database

Figure-1

Figure-2

Page
23

Form Summary:This form on the click of next accepts the regions the person
wants to travel between and further after sorting suitable
flights view all the flights in a table under VIEW FLIGHT
DETAILS tab as can be seen in the preview above.

Page
24

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


if(jRadioButton1.isSelected()==true || jRadioButton2.isSelected()==true){
if(jRadioButton1.isSelected()==true)
{
jTextField9.setText((String) jComboBox1.getSelectedItem());
jTextField10.setText((String) jComboBox2.getSelectedItem());
jTextField5.setText("INTERNATIONAL");
}
else if(jRadioButton2.isSelected()==true)
{
jTextField9.setText((String) jComboBox3.getSelectedItem());
jTextField10.setText((String) jComboBox4.getSelectedItem());
jTextField5.setText("DOMESTIC");
}
jTabbedPane1.setSelectedIndex(1);
s1 = jTextField9.getText();
s2 = jTextField10.getText();
try {
rs =st.executeQuery("select date,departure,airliner,terminal,price,area,start,end from flights
where start='"+s1+"' and end='"+s2+"' ");
} catch (SQLException ex) {
}
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
}
else {
JOptionPane.showMessageDialog(this,"Please select the type(INTERNATIONAL OR
DOMSESTIC)!!");
}

}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
try {
new mai().setVisible(true);
} catch (SQLException ex) {
Logger.getLogger(MANAGING_SOFTWARE.class.getName()).log(Level.SEVERE, null, ex);
}
dispose();

Page
25

Form Summary:This form represented above receives command from the previous selection
that the user did i.e. selecting the origin and end of the journey. The action
promotes the database to be searched through and thereby displaying all the
flights following the tour. The user can easily select the flight by simply
clicking on the flight suiting him/her.

NOTE:- The above window is just the continuation of the previous form
which are sub-contained in the same form but under different tabs just like
web-browser style.
Page
26

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


int n = 0;
int row = jTable1.getSelectedRow();
if(row>=0)
{
try
{
s1 = jTextField9.getText();
s2 = jTextField10.getText();
String s = (String) jTable1.getModel().getValueAt(row,2) ;
String s0 = (String) jTable1.getModel().getValueAt(row,0) ;
String s9 = (String) jTable1.getModel().getValueAt(row,3) ;
String s8 = (String) jTable1.getModel().getValueAt(row,1) ;
String p = (String) jTable1.getModel().getValueAt(row,4) ;
new further().setVisible(true);
dispose();
further.jTextField1.setText(s);
further.jTextField2.setText(s0);
further.jTextField3.setText(s8);
further.jTextField4.setText(s9);
further.jTextField5.setText(p.substring(2));

} catch (SQLException ex) {


Logger.getLogger(MANAGING_SOFTWARE.class.getName()).log(Level.SEVERE, null, ex);
}
}

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


jTabbedPane1.setSelectedIndex(0);

Page
27

Flights stored in database.(a few of them).

Note : The above pictures are of MySQL database software which


works at back end.
Page
28

FORM SUMMARY:This form accepts number of passengers from user and


prompts him to the payment portal.

Page
29

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


z = j6.getText().length();
int z1 = Integer.parseInt(j6.getText());
if(z>0){
n = Integer.parseInt(j6.getText());
if(jRadioButton1.isSelected()==true)
{
l = l1.getSelectedIndices().length;
if(l>n)
{
JOptionPane.showMessageDialog(this,"PLEASE DONT SELECT EXTRA SEATS");
}
else if(l<n)
{
JOptionPane.showMessageDialog(this,"PLEASE SELECT MORE SEATS");
}
else{
new class1().setVisible(true);
dispose();
class1.l3.setListData(l1.getSelectedValues());
int s1=0;
for(int j=0;j<=n-1;j++)
{
String i = (String)l3.getModel().getElementAt(j);
String s= i.substring(20);
s1 = Integer.parseInt(s)+s1;
}
int t = Integer.parseInt(jTextField5.getText()) * z1;
class1.jTextField3.setText(Integer.toString(t+s1));
class1.jTextField1.setText("ECONOMY");
class1.jTextField4.setText(AIR_RESERVATION_SYSTEM.name);
class1.jTextField5.setText(AIR_RESERVATION_SYSTEM.mob);
}}
if(jRadioButton2.isSelected()==true)
{

Page
30

l = l2.getSelectedIndices().length;
if(l>n)
{
JOptionPane.showMessageDialog(this,"PLEASE DONT SELECT EXTRA SEATS");
}
else if(l<n)
{
JOptionPane.showMessageDialog(this,"PLEASE SELECT MORE SEATS");
}
else{
new class1().setVisible(true);
dispose();
class1.l3.setListData(l2.getSelectedValues());
int s1=0;
for(int j=0;j<=n-1;j++)
{
String i = (String)l3.getModel().getElementAt(j);
String s= i.substring(20);
s1 = Integer.parseInt(s)+s1;
}
int t = Integer.parseInt(jTextField5.getText())*z1;
class1.jTextField3.setText(Integer.toString(t+s1));
class1.jTextField1.setText("FIRST");
class1.jTextField4.setText(AIR_RESERVATION_SYSTEM.name);
class1.jTextField5.setText(AIR_RESERVATION_SYSTEM.mob);
}
}
if(jRadioButton1.isSelected()==false && jRadioButton2.isSelected()==false )
{
JOptionPane.showMessageDialog(this,"SELECT CLASS");
}
}
else
{
JOptionPane.showMessageDialog(this,"PLEASE ENTER NUMBER OF PASSENGERS");
}

Page
31

FORM SUMMARY :This form receives the essential information from the
previous inputs and results and asks for the payment
through the three ways possible shown i.e. VisaCard,
Paypal, MasterCard.

Note:The image might look tilted in the figure above. It is just because of effects used
while editing .

Page
32

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


if(jRadioButton1.isSelected()==false && jRadioButton2.isSelected() == false &&
jRadioButton3.isSelected() == false)
{
JOptionPane.showMessageDialog(this,"Please select a Payment method");
}
else{
new Reservationdetails().setVisible(true);
dispose();
Reservationdetails.jTextField1.setText(jTextField4.getText());
Reservationdetails.jTextField2.setText(jTextField5.getText());
int n1 = further.l;
for(int j=0; j<=(n1-1);j++)
{
String i = (String)l3.getModel().getElementAt(j);
String seat = i.substring(0,2);
seat2 = seat+","+ seat2;
}
int m = seat2.length();
String ns = seat2.substring(0,m-5);
Reservationdetails.jTextField10.setText(ns);
Reservationdetails.jTextField4.setText(further.jTextField3.getText());
Reservationdetails.jTextField5.setText(further.jTextField2.getText());
Reservationdetails.jTextField6.setText(MANAGING_SOFTWARE.jTextField9.getText());
Reservationdetails.jTextField7.setText(MANAGING_SOFTWARE.jTextField10.getText());
if(jRadioButton1.isSelected()==true)
{ Reservationdetails.jTextField8.setText("PAYPAL"); }
if(jRadioButton2.isSelected()==true)
{ Reservationdetails.jTextField8.setText("MASTERCARD"); }
if(jRadioButton3.isSelected()==true)
{Reservationdetails.jTextField8.setText("VISACARD"); }
int f1=1;int f2=100000;
Random r = new Random();
int res = (r.nextInt()* (f2-f1)+f1);
String re=Integer.toString(res);
Reservationdetails.jTextField9.setText(re.substring(1)+jTextField1.getText().substring(0, 2));
Reservationdetails.jTextField9.setEditable(false);
}
}

Page
33

Form Summary :This form finally shows the details essential for reservation
and after the user have confirmed these he/she presses
reserve which stores the flight record in the database that
Can be tracked later using the UNIQUE CODE provided.

Page
34

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


JOptionPane.showMessageDialog(this,"FLIGHT RESERVED , HAVE A NICE DAY !")
try
{
String Name = jTextField1.getText();
String contact = jTextField2.getText();
String seatnumber = jTextField10.getText();
String departure = jTextField4.getText();
String date = jTextField5.getText();
String origin = jTextField6.getText();
String end = jTextField7.getText();
String payment = jTextField8.getText();
String uni = jTextField9.getText();
String FLIGHT = further.jTextField1.getText();
Class.forName("java.sql.DriverManager");
Connection con = (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql", "root","");
Statement stmt = (Statement) con.createStatement();
String query="INSERT INTO reserved VALUES
('"+Name+"','"+contact+"','"+FLIGHT+"','"+seatnumber+"','"+departure+"','"+date+"','"+origin+"','"+e
nd+"','"+payment+"','"+uni+"');";
stmt.executeUpdate(query);
}
catch (Exception e)
{
JOptionPane.showMessageDialog (this, e.getMessage());
}

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


try {
new mai().setVisible(true);
} catch (SQLException ex) {
Logger.getLogger(Reservationdetails.class.getName()).log(Level.SEVERE, null, ex);
}
dispose();

Page
35

DO TAKE A NOTE OF THIS


The reservation form provides a UNIQUE CODE to every costumers who
tries to reserve the flight and this unique code can help the customer
to see the record of his flight easily by clicking on the CHECK FLIGHT
STATUS on the main form which will retrieve the particular record
from the database showing his/her flight details.
The Illustration is given below. In the above figure the textfield with
unique code which has been copied

The user enter his/her unique number and gets the flight
record displayed accordingly.

Page
36

FORM SUMMARY:This form is administration based form which allow the


administrators to modify the flight as well as seat details
from wherever they desire thereby saving time . This form
asks the admin for the password the administration uses and
hence it further opens a modifying window which can help
to add , delete the flights from the record database.

Page
37

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


int c=0;String sql=" Select * from admin ";
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con= (Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql","root","");
Statement stmt = (Statement) con.createStatement();
Statement stmt1 = (Statement) con.createStatement();
ResultSet rs = stmt.executeQuery(sql);
String user=jTextField1.getText();
String pwd= new String (jPasswordField1.getPassword());
while(rs.next())
{
String uname=rs.getString("USERNAME");
String password=rs.getString("PASSWORD");
if ((user.equals(uname)) && (pwd.equals(password)))
{
c=1;
}
}
if(c==1)
{
new addschedule().setVisible(true);
dispose();
}
if(c==0)
{
System.exit(0);
}
}
catch (Exception e)
{
JOptionPane.showMessageDialog(this, e.getMessage());
}

Page
38

FORM SUMMARY:This form can easily modify the flight schedule with the
help of buttons INSERT, DELETE which can add as well as
delete a particular desired row from the database.

NOTE:Here FN refers to the unique number that is assigned to every row


and acting as a primary key which helps in reducing the bulky and
complex coding to remove a row . However use of primary key makes
removal easy.

Page
39

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


int r = jTable1.getSelectedRow();
String date = (String) jTable1.getValueAt(r,0);
String departure = (String) jTable1.getValueAt(r,1);
String airliner = (String) jTable1.getValueAt(r,2);
String terminal = (String) jTable1.getValueAt(r,3);
String Price = (String) jTable1.getValueAt(r,4);
String start = (String) jTable1.getValueAt(r,6);
String end = (String) jTable1.getValueAt(r,7);
String area = (String) jTable1.getValueAt(r,5);
String FN = (String) jTable1.getValueAt(r,8);
try {
String query = "INSERT INTO flights VALUES
('"+date+"','"+departure+"','"+airliner+"','"+terminal+"','"+Price+"','"+area+"','"+start+"','"+end+"','"+
FN+"');";
st1.executeUpdate(query);
} catch (SQLException ex) {
Logger.getLogger(addschedule.class.getName()).log(Level.SEVERE, null, ex);
}

}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
try {
rs2 =st1.executeQuery("Select * from flights");
} catch (SQLException ex) {
Logger.getLogger(addschedule.class.getName()).log(Level.SEVERE, null, ex);
}
jTable1.setModel(DbUtils.resultSetToTableModel(rs2));

}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
int row = jTable1.getSelectedRow();
if(row>=0)
{
try {
rs3 =st1.executeQuery("select * from flights LIMIT 1 OFFSET "+row+" ");
while(rs3.next())
{
String s = rs3.getString("FN");
String query = " delete from flights where FN = '"+s+"' ";

Page
40

st2.executeUpdate(query);
}}
catch(Exception e ){}
}

If you observe the preview image and the above and below
one you will observe that the row with primary key 101 has
been removed and with 1001 has been added. Such is
obtained by the action of delete and insert button.

Page
41

The sources that proved out to be very useful during


the making of the project are listed below.
www.wikipedia.org
www.NetBeans.org
www.MySQl.org
www.Shutterstock.com
www.youtube.com
CBSE CLASS 11/12 Informatics Practices.
and many more.

Page
42

You might also like