Project Report File
Project Report File
ABISHEK ADITYA
CLASS: XII-B
Date: 29/01/2014
CERTIFICATE
This is to certify that Abishek Aditya has completed the project titled
Flight Reservation System under my supervision in partial fulfillment of
the requirement for the award of the 12th standard.
To the best of my knowledge, the same has not been submitted in any
other school for the purpose of pursuing any other course.
Internal Supervisor
Mrs. Kanika Agarwal
(Computer teacher)
External Supervisor
ACKNOWLEDGEMENT
I wish to express my deep gratitude and sincere thanks to Ms. for her
encouragement and for all the facilities that he provided for this project
work.
I sincerely appreciate this magnanimity by taking me into his fold for
which I shall remain indebted .I extend my hearty thanks to my computer
teacher who guided me to do this project successful completion of this
project. I take this opportunity to express my deep sense of gratitude for
her invaluable guidance constant encouragement, constructive comments,
sympathetic attitude and immense motivation which has sustained my
effort at all stages of this project work.
ABISHEK ADITYA
DECLARATION
This is the report of the project work entitled:
Flight Reservation System
Abishek Aditya
Class XII B
CONTENTS
Coding....
.. 6
Software Requirements. 22
Output
.. 23
Bibliography................................................. 41
CODING
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream.h>
#include<time.h>
#include<iomanip.h>
#include<fstream.h>
char f[10]="f";
char s[10]="s";
int addr,ad,flag,f1,d,m,i,amt;
float tamt;
class login
{
public:
char id[100];
char pass[100];
char *password;
void getid()
{
cout<<"Enter your id:";gets(id);
password=getpass("Enter the password:");
strcpy(pass,password);
}
void displayid()
{
cout<<"Id:";puts(id);
cout<<"Password:";puts(pass);
}
};
class detail
{
public:
int tno;
char tname[100];
char bp[100];
char dest[100];
int c1,c1fare;
int c2,c2fare;
int d,m,y;
void getdetail()
{
cout<<"Enter the details as follows\n";
cout<<"Flight no:";cin>>tno;
cout<<"Flight name:";gets(tname);
cout<<"Boarding point:";gets(bp);
cout<<"Destination pt:";gets(dest);
cout<<"No of seats in Business class & fare per ticket:";
cin>>c1>>c1fare;
cout<<"No of seats in Economy class & fare per ticket:";
cin>>c2>>c2fare;
cout<<"Date of travel:";cin>>d>>m>>y;
}
void displaydetail()
{
cout<<tno<<"\t"<<tname<<"\t"<<bp<<"\t"<<dest<<"\t";
cout<<c1<<"\t"<<c1fare<<"\t"<<c2<<"\t"<<c2fare<<"\t";
cout<<d<<"-"<<m<<"-"<<y<<"\t"<<endl;
}
};
class reser
{
public:
int Ticket;
int tno;
char tname[100];
char bp[10];
char dest[100];
char pname[10][100];
int age[20];
char clas[10];
int nosr;
int i;
int d,m,y;
int con;
float amc;
void getresdet()
{
cout<<"Enter the details as follows\n";
cout<<"Flight no:";cin>>tno;
cout<<"Flight name:";gets(tname);
cout<<"Boarding point:";gets(bp);
cout<<"Destination pt:";gets(dest);
cout<<"No of seats required:";cin>>nosr;
for(i=0;i<nosr;i++)
{
cout<<"Passenger name:";gets(pname[i]);
cout<<"Passenger age:";cin>>age[i];
}
cout<<"Enter the class b-Business class e-Economy class:";
gets(clas);
cout<<"Date of travel:";cin>>d>>m>>y;
cout<<"Enter the concession category\n";
cout<<"1.Military\n2.Senior citizen\n";
cout<<"3.Children below 5 yrs\n4.None\n";
cin>>con;
cout<<"............END OF GETTING DETAILS............\n";
}
void displayresdet()
{
cout<<"...............................................\n";
cout<<"...............................................\n";
cout<<"Ticket no:"<<Ticket;
cout<<"\nFlight no:"<<tno;
cout<<"\nFlight name:";puts(tname);
cout<<"Boarding point:";puts(bp);
cout<<"Destination pt:";puts(dest);
cout<<"No of seats reserved:"<<nosr;
for(i=0;i<nosr;i++)
{
cout<<"Passenger name:";puts(pname[i]);
cout<<"Passenger age:"<<age[i];
}
cout<<"\nYour class:";puts(clas);
cout<<"\nDate of reservation:"<<d<<"-"<<m<<"-"<<y;
cout<<"\nYour concession category:"<<con;
cout<<"\nYou must pay:"<<amc<<endl;
cout<<"***********************************************\n";
cout<<".........END OF RESERVATION.................\n";
cout<<"***********************************************\n";
}
};
class canc
{
public:
int Ticket;
int tno;
char tname[100];
char bp[10];
char dest[100];
char pname[10][100];
int age[20];
int i;
char clas[10];
int nosc;
int d,m,y;
float amr;
void getcancdet()
{
cout<<"Enter the details as follows\n";
cout<<"Ticket no:";cin>>Ticket;
cout<<"Date of Cancellation:";cin>>d>>m>>y;
cout<<"...........END OF GETTING DETAILS...........\n";
}
void displaycancdet()
{
cout<<"...........................................\n";
cout<<"...........................................\n";
cout<<"Ticket no:"<<Ticket;
cout<<"\nFlight no:"<<tno;
cout<<"\nFlight name:";puts(tname);
cout<<"Boarding point:";puts(bp);
cout<<"Destination pt:";puts(dest);
cout<<"\nYour class:";puts(clas);
cout<<"no of seats to be Cancelled:"<<nosc;
for(i=0;i<nosc;i++)
{
cout<<"Passenger name:";puts(pname[i]);
cout<<"passenger age:"<<age[i];
}
cout<<"\nDate of Cancellation:"<<d<<"-"<<m<<"-"<<y;
cout<<"\nYou can collect:"<<amr<<"rs"<<endl;
cout<<"*****************************************\n";
cout<<".........END OF CANCELLATION.............\n";
cout<<"*****************************************\n";
}
};
void manage();
void can();
void user();
void database();
void res();
void reserve();
void displaypassdetail();
void Cancel();
void enquiry();
void main()
{
clrscr();
int ch;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\
n";
cout<<".......WELCOME TO FLIGHT RESERVATION
SYSTEM..........\n";
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\
n";
do
{
cout<<"^^^^^^^^^^^^^^^^^^^^^^MAIN
MENU^^^^^^^^^^^^^^^^^^^^\n";
cout<<"1.Admin mode\n2.User mode\n3.Exit\n";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
database();
break;
case 2:
user();
break;
case 3:
exit(0);
}
}while(ch<=3);
getch();
}
void database()
{
char *password;
char *pass="12345678";
password=getpass("Enter the admininistrator password:");
detail a;
fstream f;
int ch;
char c;
if(strcmp(pass,password)!=0)
{
cout<<"Enter the password correctly \n";
cout<<"You are not permitted to logon this mode\n";
goto h;
}
if(strcmp(pass,password)==0)
{
char c;
do
{
cout<<"...........ADMINISTRATOR MENU...........\n";
cout<<"1.Create detail data base\n2.Add details\n";
cout<<"3.Display details\n4.User management\n";
cout<<"5.Display passenger details\n6.Return to main menu\n";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
f.open("t.txt",ios::out|ios::binary);
do
{
a.getdetail();
f.write((char *) & a,sizeof(a));
cout<<"Do you want to add one more record?\n";
cout<<"y-for Yes\nn-for No\n";
cin>>c;
}while(c=='y');
f.close();
break;
case 2:
f.open("t.txt",ios::in|ios::out|ios::binary|ios::app);
a.getdetail();
f.write((char *) & a,sizeof(a));
f.close();
break;
case 3:
f.open("t.txt",ios::in|ios::out|ios::binary|ios::app);
f.seekg(0);
while(f.read((char *) & a,sizeof(a)))
{
a.displaydetail();
}
f.close();
break;
case 4:
manage();
break;
case 5:
displaypassdetail();
break;
}
}while(ch<=5);
f.close();
}
h:
}
void reserve()
{
int ch;
do
{
cout<<"1.Reserve\n2.Return to the main menu\n";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
res();
break;
}
}while(ch==1);
getch();
}
void res()
{
detail a;
reser b;
fstream f1,f2;
time_t t;
f1.open("t.txt",ios::in|ios::out|ios::binary);
f2.open("p.txt",ios::in|ios::out|ios::binary|ios::app);
int ch;
b.getresdet();
while(f1.read((char *) &a,sizeof(a)))
{
if(a.tno==b.tno)
{
if(strcmp(b.clas,f)==0)
{
if(a.c1>=b.nosr)
{
amt=a.c1fare;
addr=f1.tellg();
ad=sizeof(a.c1);
f1.seekp(addr-(7*ad));
a.c1=a.c1-b.nosr;
f1.write((char *) & a.c1,sizeof(a.c1));
if(b.con==1)
{
cout<<"Concession category:MILITARY PERSONNEL\n";
b.amc=b.nosr*((amt*50)/100);
}
else if(b.con==2)
{
cout<<"Concession category:SENIOR CITIZEN\n";
b.amc=b.nosr*((amt*60)/100);
}
else if(b.con==3)
{
}
else
{
flag=0;
}
}
if(flag==0)
{
cout<<"............Wrong Flight no......................\n";
cout<<"......Enter the Flight no from the data base.....\n";
}
f1.close();
f2.close();
getch();
h:
}
void displaypassdetail()
{
fstream f;
reser b;
f.open("p.txt",ios::in|ios::out|ios::binary);
f.seekg(0);
while(f.read((char *) & b,sizeof(b)))
{
b.displayresdet();
}
f.close();
getch();
}
void enquiry()
{
fstream f;
f.open("t.txt",ios::in|ios::out|ios::binary);
detail a;
while(f.read((char *) & a,sizeof(a)))
{
a.displaydetail();
}
getch();
}
void Cancel()
{
detail a;
reser b;
canc c;
fstream f1,f2,f3;
f1.open("t.txt",ios::in|ios::out|ios::binary);
f2.open("p.txt",ios::in|ios::out|ios::binary);
f3.open("cn.txt",ios::in|ios::out|ios::binary);
cout<<"**********CANCELLATION MENU*********\n";
c.getcancdet();
while(f2.read((char *) & b,sizeof(b)))
{
if(b.Ticket==c.Ticket)
{
c.tno=b.tno;
strcpy(c.tname,b.tname);
strcpy(c.bp,b.bp);
strcpy(c.dest,b.dest);
c.nosc=b.nosr;
for(int j=0;j<c.nosc;j++)
{
strcpy(c.pname[j],b.pname[j]);
c.age[j]=b.age[j];
}
strcpy(c.clas,b.clas);
if(strcmp(c.clas,f)==0)
{
while(f1.read((char *) & a,sizeof(a)))
{
if(a.tno==c.tno)
{
a.c1=a.c1+c.nosc;
d=a.d;
m=a.m;
addr=f1.tellg();
ad=sizeof(a.c1);
f1.seekp(addr-(7*ad));
f1.write((char *) & a.c1,sizeof(a.c1));
tamt=b.amc;
if((c.d==d)&&(c.m==m))
{
cout<<"You are canceling at the date of departure\n";
c.amr=tamt-((tamt*60)/100);
}
else if(c.m==m)
{
cout<<"You are canceling at the month of departure\n";
c.amr=tamt-((tamt*50)/100);
}
else if(m>c.m)
{
cout<<"You are canceling one month before the date of departure\n";
c.amr=tamt-((tamt*20)/100);
}
else
{
cout<<"Canceling after the departure\n";
cout<<"Your request cannot be completed\n";
}
goto h;
c.displaycancdet();
}
}
}
else if(strcmp(c.clas,s)==0)
{
while(f1.read((char *) & a,sizeof(a)))
{
if(a.tno==c.tno)
{
a.c2=a.c2+c.nosc;
d=a.d;
m=a.m;
addr=f1.tellg();
ad=sizeof(a.c2);
f1.seekp(addr-(5*ad));
f1.write((char *) & a.c2,sizeof(a.c2));
tamt=b.amc;
if((c.d==d)&&(c.m==m))
{
cout<<"You are canceling at the date of departure\n";
c.amr=tamt-((tamt*60)/100);
}
else if(c.m==m)
{
cout<<"You are canceling at the month of departure\n";
c.amr=tamt-((tamt*50)/100);
}
else if(m>c.m)
{
cout<<"You are canceling one month before the date of departure\n";
c.amr=tamt-((tamt*20)/100);
}
else
{
cout<<"Canceling after the departure\n";
cout<<"Your request cannot be completed\n";
}
goto h;
c.displaycancdet();
}
}
}
}
else
{
flag=0;
}
}
h:
if(flag==0)
{
cout<<"Enter the correct Ticket no\n";
}
f1.close();
f2.close();
f3.close();
getch();
}
void can()
{
int ch;
do
{
cout<<".................CANCELLATION MENU.........\n";
{
cout<<"1.Reserve\n2.Cancel\n3.Enquiry\n4.Return to the main menu\n";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
reserve();
break;
case 2:
Cancel();
break;
case 3:
enquiry();
break;
}
}while(ch<=3);
goto j;
}
else
{
d=1;
}
}
if(d==1)
{
cout<<"Enter your user id and password correctly\n";
}
getch();
j:
}
void manage()
{
int ch;
fstream f;
char c;
login a;
cout<<".........WELCOME TO THE USER MANAGEMENT
MENU........\n";
do
{
cout<<"1.Create id data base\n2.Add details\n";
cout<<"3.Display details\n4.Return to the main menu\n";
cout<<"Enter your choice:";
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
f.open("id.txt",ios::out|ios::binary);
do
{
a.getid();
f.write((char *) & a,sizeof(a));
cout<<"Do you want to add one more record\n";
cout<<"y-Yes\nn-No\n";
cin>>c;
}while(c=='y');
f.close();
break;
case 2:
f.open("id.txt",ios::in|ios::out|ios::binary|ios::app);
a.getid();
f.write((char *) & a,sizeof(a));
f.close();
break;
case 3:
f.open("id.txt",ios::in|ios::out|ios::binary);
f.seekg(0);
while(f.read((char *) & a,sizeof(a)))
{
a.displayid();
}
f.close();
break;
}
}while(ch<=3);
getch();
}
SOFTWARE REQUIREMENTS
Turbo C++
Windows 95 & onwards
Output
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.......WELCOME TO FLIGHT RESERVATION SYSTEM.....................
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
^^^^^^^^^^^^^^^^^^^^^^MAIN MENU^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.Admin mode
2.User mode
3.Exit
Enter your choice:1
.............................ADMINISTRATOR MENU....................................
1.Create detail data base
2.Add details
3.Display details
4.User management
5.Display passenger details
6.Return to main menu
Enter your choice:2
.............................ADMINISTRATOR MENU.......................................
1.Create detail data base
2.Add details
3.Display details
4.User management
5.Display passenger details
6.Return to main menu
Enter your choice:3
Trno Trname
Bpt
Dest
Fs
Ffare
Ss
123
yercaud exp
200
200
100
2-3-2009
124
shatapti exp
200
200
300
4-5-2009
126
kurula exp
300
300
200
4-3-2009
.............................ADMINISTRATOR MENU.................................................
1.Create detail data base
2.Add details
3.Display details
4.User management
5.Display passenger details
6.Return to main menu
Enter your choice:4
n-No
y
Enter your id:ajinth
Enter the password:**********
Do you want to add one more record
y-Yes
n-No
y
Enter your id:bala
Enter the password:********
Do you want to add one more record
y-Yes
n-No
y
Enter your id:hemanth
Enter the password:*********
Do you want to add one more record
y-Yes
n-No
n
1.Create id data base
2.Add details
3.Display details
4.Return to the main menu
Enter your choice:2
Enter your id:berlin
Enter the password:*********
1.Create id data base
2.Add details
3.Display details
4.Return to the main menu
Enter your choice:3
Id:ashwin
Password:11111111
Id:ajinth
Password:22222222
Id:bala
Password:33333333
Id:prem
Password:44444444
Id:hemanth
Password:55555555
Id:berlin
Password:66666666
1.Create id data base
2.Add details
3.Display details
4.Return to the main menu
Enter your choice:4
. .............................ADMINISTRATOR MENU........................
1.Create detail data base
2.Add details
3.Display details
4.User management
5.Display passenger details
6.Return to main menu
Enter your choice:5
.............................ADMINISTRATOR MENU...................................
1.Create detail data base
2.Add details
3.Display details
4.User management
5.Display passenger details
6.Return to main menu
Enter your choice:6
^^^^^^^^^^^^^^^^^^^^^^MAIN MENU^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.Admin mode
2.User mode
3.Exit
Enter your choice:2
************************************************************************
**********WELCOME TO THE USER MENU********************
************************************************************************
Enter your id:
ashwin
Enter your password:*********
Enter your user id and password correctly
^^^^^^^^^^^^^^^^^^^^^^MAIN MENU^^^^^^^^^^^^^^^^^^^^^^^
1.Admin mode
2.User mode
3.Exit
Enter your choice:2
**********************************************************************
Passenger name:latha
Passenger age:45
Passenger name:mala
Passenger age:23
Passenger name:vimala
Passenger age:32
Passenger name:kathir
Passenger age:12
Passenger name:kosi
Passenger age:43
Enter the class b-Business class e-Economy class:f
Date of travel:2 2 2009
Enter the concession category
1.Military
2.Senior citizen
3.Children below 5 yrs
4.None
4
..................................END OF GETTING DETAILS..............................
You cannot get any concession
..............................................................................................................
...............................................................................................................
Ticket no:10770
Flight no:123
Flight name:yercaud
Boarding point:erode
Destination pt:chennai
No of seats reserved:10Passenger name:raja
Passenger age:45Passenger name:ragu
1.Reserve
2.Cancel
3.Enquiry
4.Return to the main menu
Enter your choice:3
Trno Trname
Bpt
Dest
Fs
Ffare
erode chennai 90
200
Ss
123
yercaud exp
200
100
2-3-2009
124
shatapti exp
200
200
300
4-5-2009
126
kurula exp
300
300
200
4-3-2009
1.Reserve
2.Cancel
3.Enquiry
4.Return to the main menu
Enter your choice:2
*********************************CANCELLATION MENU******************************
Enter the details as follows
Ticket no:10770
Date of Cancellation:2 3 2009
..............................................END OF GETTING DETAILS.....................................
You are canceling at the date of departure
..................................................................................................................................
...................................................................................................................................
Ticket no:10770
Flight no:123
Flight name:yercaud
Boarding point:erode
Destination pt:chennai
Your class:f
no of seats to be Cancelled:10
Passenger name: raja passenger age: 45
Passenger name: ragu passenger age: 32
Passenger name: ravi passenger age: 34
Passenger name: vinoth passenger age: 23
Passenger name: raju passenger age: 24
Passenger name: latha passenger age:45
Passenger name: mala passenger age: 23
Passenger name: vimala passenger age: 32
Passenger name: kathir passenger age: 12
Passenger name: kosi passenger age: 43
Date of Cancellation:2-3-2009
You can collect: 800rs
*********************************************************************************
..........END OF CANCELLATION................................
*********************************************************************************
1.Reserve
2.Cancel
3.Enquiry
4.Return to the main menu
Enter your choice:2
**************************CANCELLATION MENU***************************
Enter the details as follows
Ticket no:12234
Date of Cancellation:2 3 2009
............END OF GETTING DETAILS......................................
1.Reserve
2.Cancel
3.Enquiry
4.Return to the main menu
Enter your choice:3
Trno Trname
Bpt
Dest
Fs
Ffare
200
Ss
123
yercaud exp
200
100
2-3-2009
124
shatapti exp
200
200
300
4-5-2009
126
kurula exp
300
300
200
4-3-2009
1.Reserve
2.Cancel
3.Enquiry
4.Return to the main menu
Enter your choice:3
Trno Trname
Bpt
Dest
Fs
Ffare
200
Ss
123
yercaud exp
200
100
2-3-2009
124
shatapti exp
200
200
300
4-5-2009
126
kurula exp
300
300
200
4-3-2009
1.Reserve
2.Cancel
3.Enquiry
4.Return to the main menu
Enter your choice:1
1.Reserve
2.Return to the main menu
Enter your choice:1
Enter the details as follows
Flight no:12345
Flight name:shatapti
Boarding point:chennai
Destination pt:bombay
No of seats required:1
Passenger name:raja
Passenger age:23
Enter the class b-Business class e-Economy class:f
Date of travel:3 2 2009
Enter the concession category
1.Military
2.Senior citizen
3.Children below 5 yrs
4.None
4
.....................................END OF GETTING DETAILS...................................
............Wrong Flight no.............................................................
^^^^^^^^^^^^^^^^^^^^^^^MAIN MENU^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.Admin mode
2.User mode
3.Exit
^^^^^^^^^^^^^^^^^^^^^^MAIN MENU^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1.Admin mode
2.User mode
3.Exit
Enter your choice:1
Enter the admininistrator password:*********
.............................ADMINISTRATOR MENU....................................
1.Create detail data base
2.Add details
3.Display details
4.User management
5.Display passenger details
6.Return to main menu
. .............................ADMINISTRATOR MENU...................................
BIBLIOGRAPHY
Books
C++ With Sumita Arora = Class XII
Web Sites
http://www.irctc.com
http://stackoverflow.com/
www.cprogramming.com/