Professional Documents
Culture Documents
Informatics Practices Airline Reservation System
Informatics Practices Airline Reservation System
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.
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
Ubuntu 9.10:
Processor: 600 MHZ Intel Pentium IV or equivalent
Memory : 512 MB
Disk Space: 250MB 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 .
Page 8
Whereas the Administrator has functionalities as shown:
Page 9
Page
10
START
Accept
YES choice
No No No
Accept Accept Accept
login Information login
details details
Store Data
Page
11
A
OPEN BOOKING
SYSTEM FORM
ACCEPT
FLIGHT
DETAILS
If choice = If choice =
Domestic International
ACCEPT ACCEPT
FLIGHT FLIGHT
Page
12
B
Accept
passengers
Accept
class
If choice = If choice =
Economy First
OPEN PAYMENT
WINDOW
Page
13
C
ACCEPT
CHOICE
RESERVE FLIGHT
STOP
Page
14
There are 10 forms in total :-
1. Main Form
2. Login Form
3. Signup Form
7. Reservation Form
Page
15
FORM SUMMARY :-
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();
}
Page
17
FORM S UMMARY :-
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());
}
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());
}
}
}
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+"' ");
}
jTable1.setModel(DbUtils.resultSetToTableModel(rs));
}
else {
JOptionPane.showMessageDialog(this,"Please select the type(INTERNATIONAL OR
DOMSESTIC)!!");
}
}
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();
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));
Page
27
Flights stored in database.(a few of them).
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;
}
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 Su mmary :-
This form finally shows the details essential for the reservation and
after user have confirmed these he/she presses reserve
ase that Can
whichbestores
tr the flight record in the datab acked
ovided. later using the „UNIQUE CODE‟ pr
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();
stmt.executeUpdate(query);
}
catch (Exception e)
{
JOptionPane.showMessageDialog (this, e.getMessage());
}
}
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:-
Page
37
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int c=0;String sql=" Select * from admin ";
try
{
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);
}
}
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