You are on page 1of 16

Amritsar College of Engineering & Technology,

Amritsar

Project Report
On
Flight Reservation System

Submitted in the Partial fulfillment of the requirement for the Award of Degree of

Bachelor of Technology
in
COMPUTER SCIENCE & ENGINEERING

Batch
(2021-25)

Submited To: Submited By:


Ms. Anamika Jain Sachin kumar (1221158)
(Assistant Professor) Shivam kumar (1221163)
Rahul kumar (1221152)
Ranjan kumar (1221163)
ACKNOWLEDGEMENTS

This is a humble effort to express my sincere gratitude towards those who have guided and helped
us to complete this project

A project is major milestone during the study period of a student. As such this project was a
challenge to us and was an opportunity to prove our caliber. We are highly grateful and obliged to
each and everyone.

It would not have been possible to see through the undertaken project without the guidance of
Ms.Anamika Jain. It was purely on the basis of their experience and knowledge that we able to
clear all the theoretical and technical hurdles during the development phases of this project work.

Last but not the least we are very thankful to our Head of Department Ms. Binod Kaur and all
Members of Computer Science Department. who gave us an opportunity to face real time problems
while fulfilling need of an organization by making projects for them.

Page No. 2
DECLARATION

We hearby declare that the project work entited “Flight Reservation System” is an authentic
record of our own work carried out as requirement of Amritsar College of Engineering and
Technology, Amritsar under the guidance of Ms Anamika Jain.

Name Of Students :

Sachin kumar (1221158)

Shivam kumar (1221163)

Rahul kumar (1221152)

Ranjan kumar (1221155)

Page No. 3
INDEX PAGE

Sr. Content Page No.


No.
1. Introduction about the Language Used 5-7
2. Objectives of the project 8
3. Project Code 9-16
4. References

Page No. 4
Introduction to C

The Origins of C

A successor to the programming language B, C was originally developed at Bell Labs by Dennis Ritchie
between 1972 and 1973 to construct utilities running on Unix. It was applied to re-implementing the kernel of the
Unix operating system. During the 1980s, C gradually gained popularity. A successor to the programming
language B, C was originally developed at Bell Labs by Dennis Ritchie between 1972 and 1973 to construct
utilities running on Unix. It was applied to re-implementing the kernel of the Unix operating system. During the
1980s, C gradually gained popularity.

The Programming Environment

We need several pieces of software:

• Microsoft Windows. Microsoft's Windows kernel is developed mostly in C, with some parts in assembly language.
...
• Linux. ...
• Mac. ...
• Mobile. ...
• Databases. ...
• 3D Movies. ...
• Embedded Systems. ...
• Portability and Efficiency.

Page No. 5
Program Execution Stages

The Features of C

C is a procedural programming language. It was initially developed by Dennis Ritchie in the year 1972. It
was mainly developed as a system programming language to write an operating system. The main
features of C language include low-level access to memory, a simple set of keywords, and a clean style,
these features make C language suitable for system programmings like an operating system or compiler
development.
Features of C Programming Language:

• Procedural Language
• Fast and Efficient
• Modularity
• Statically Type
• General-Purpose Language
• Rich set of built-in Operators
• Libraries with rich Functions
• Middle-Level Language
• Portability
• Easy to Extend

Page No. 6
1. Procedural Language: In a procedural language like C step by step predefined instructions are
carried out. C program may contain more than one function to perform a particular task. New people to
programming will think that this is the only way a particular programming language works. There are
other programming paradigms as well in the programming world. Most of the commonly used
paradigm is an object-oriented programming language.

2. Fast and Efficient: Newer languages like java, python offer more features than c programming
language but due to additional processing in these languages, their performance rate gets down
effectively. C programming language as the been middle-level language provides programmers access
to direct manipulation with the computer hardware but higher-level languages do not allow this. That’s
one of the reasons C language is considered the first choice to start learning programming languages.
It’s fast because statically typed languages are faster than dynamically typed languages.

3. Modularity: The concept of storing C programming language code in the form of libraries for further
future uses is known as modularity. This programming language van does very little on its own most of
its power is held by its libraries. C language has its own library to solve common problems like in this
we can use a particular function by using a header file stored in its library.

4. Statically Type: C programming language is a statically typed language. Meaning the type of variable
is checked at the time of compilation but not at run time. This means each time a programmer type a
program they have to mention the type of variables used.

5. General Purpose Language: From system programming to photo editing software, the C
programming language is used in various applications. Some of the common applications where it’s
used are as follows:
• Operating systems: Windows, Linux, iOS, Android, OXS
• Databases: PostgreSQL, Oracle, MySQL, MS SQL Server etc.
6. Rich set of built-in Operators: It is a diversified language with a rich set of built-in operators which
are used in writing complex or simplified C programs.

7. Libraries with rich Functions: Robust libraries and functions in C help even a beginner coder to
code with ease.

8. Middle-Level Language: As it is a middle-level language so it has the combined form of both


capabilities of assembly language and features of the high-level language.

9. Portability: C language is lavishly portable as programs that are written in C language can run and
compile on any system with either none or small changes.

10. Easy to Extend: Programs written in C language can be extended means when a program is already
written in it then some more features and operations can be added to it.

Page No. 7
OBJECTIVES OF THE PROJECT

The flight Reservation System is designed for any for any Airline. The Project Flight reservation system
includes seat reservation of passenger, stering facilities.
The purpose of the project as “Flight reservation system” is to develop software which is
user,friendly,simple,fast and cost-effective cost booking system.
The new system is to make an easier flight reservation system.

Proposed system will contain;

Records of passengers
List of seats available
Alternate option of flight
Price of Seat

Page No. 8
Project Code

o #include<stdio.h>
o #include<time.h>
o #include<string.h>
o #include<stdlib.h>
o
o #define totalSeats 60
o #define filled 35
o
o char colName[6] ={'A','B','C','D','E','F'};
o void home();
o
o int pCnt;
o int currF;
o struct node {
o char fName[30];
o char Lname[20];
o char mob[30];
o int r;
o char c;
o char flightName[30];
o };
o
o struct node passen[51];
o
o struct flight{
o char name[30];
o int seats[10][6];
o int cnt;
o };
o
o struct flight newf(char name[30])
o {
o int i,j,cnt;
o struct flight tmp;
o strcpy(tmp.name,name);
o for(i=0;i<10;i++)
Page No. 9
o {
o for(j=0;j<6;j++)
o {
o tmp.seats[i][j]=0;
o }
o }
o cnt = 0;
o while(cnt != filled)
o {
o int x = rand()%60;
o int r,c;
o r=x/6;
o c=x%6;
o if(tmp.seats[r][c]==0)
o {
o cnt++;
o tmp.seats[r][c]=1;
o }
o }
o return tmp;
o }
o struct flight f[2];
o
o void print()
o {
o int i,j;
o printf("seat marked with 'X' is filled\n\n");
o printf(" A B C D E F\n");
o
o for(i=0;i<10;i++)
o {
o printf("%d",i+1);
o if(i != 9)
o printf(" ");
o for(j=0;j<6;j++)
o {
o if(j==3)
o {

Page No. 10
o if(f[currF].seats[i][j]==1)
o printf(" X");
o else
o printf(" -");
o }
o else
o {
o if(f[currF].seats[i][j]==1)
o printf(" X");
o else
o printf(" -");
o }
o }
o printf("\n");
o }
o }
o
o int len(char s[30])
o {
o int i=0;
o while(s[i]!='\0')
o {
o i++;
o }
o if(i==10)
o return 1;
o else
o return 0;
o }
o
o void regis(int r,int c)
o {
o char s[30];
o int z,flag,i;
o printf("\nEnter first name\n");
o scanf("%s",&passen[pCnt].fName);
o printf("\nEnter Last name\n");
o scanf("%s",&passen[pCnt].Lname);

Page No. 11
o while(1){
o for(z=0;z<30;z++)
o s[z]='\0';
o
o printf("\nenter 10 digit mob num\n");
o scanf("%s",&s);
o if(len(s)==0)
o {
o printf("invalid length/character !!\n");
o
o continue;
o }
o flag=0;
o for(i=0;i<10;i++)
o {
o if(s[i]<48 || s[i]>57)
o {
o printf("invalid length/character !!!\n");
o flag=1;
o break;
o }
o }
o if(flag==0)
o break;
o }
o strcpy(passen[pCnt].mob,s);
o passen[pCnt].r=r+1;
o passen[pCnt].c=colName[c];
o strcpy(passen[pCnt].flightName,f[currF].name);
o printf("\n********SEAT BOOKED******\n");
o printf("*** Flight : %s ** seat : %d-%c
***\n",passen[pCnt].flightName,passen[pCnt].r,passen[pCnt].c);
o pCnt++;
o home();
o
o }
o
o
o void res()
Page No. 12
o {
o int r,c;
o char col,sel;
o print();
o while(1){
o printf("select AVAILABLE seat {format (5 B)}\n");
o scanf("%d %c",&r,&col);
o r--;
o c=col-'A';
o if( r >9 || c>5)
o printf("wrong selection\n");
o else if(f[currF].seats[r][c]==1)
o printf("seat already filled\n");
o else
o break;
o }
o printf("seat %d-%c selected\n",r+1,colName[c]);
o printf("\nPress Y to confirn else anything to go home\n");
o
o scanf(" %c",&sel);
o
o if(sel =='Y' || sel=='y')
o {
o f[currF].seats[r][c]=1;
o f[currF].cnt++;
o regis(r,c);
o }
o else
o {
o home();
o }
o
o }
o
o void printList()
o {
o int i;
o for(i=0;i<pCnt;i++)

Page No. 13
o {
o printf("\n");
o printf("%d.\n%s %s\n",i+1,passen[i].fName,passen[i].Lname);
o printf("%s\n",passen[i].mob);
o printf("flight : %s\n",passen[i].flightName);
o printf("seat : %d %c\n",passen[i].r,passen[i].c);
o }
o printf("\n");
o home();
o }
o
o void selF()
o {
o int ch=0;
o int x,c;
o printf("\nSelect flight\n\n");
o c=0;
o if(f[0].cnt<60)
o {
o printf("flight no. : %d\n",++c);
o printf("Flight : %s\nAvailable seats: %d ",f[0].name,60-f[0].cnt);
o printf("Price : %d\n\n",1000+f[0].cnt*22);
o }
o if(f[1].cnt<60)
o {
o printf("flight no. : %d\n",++c);
o printf("Flight : %s\nAvailable seats: %d ",f[1].name,60-f[1].cnt);
o printf("Price : %d\n\n",1050+f[1].cnt*21);
o }
o while(1){
o printf("select flight no.\n");
o scanf("%d",&x);
o if(x==1 && f[0].cnt<60)
o {
o ch=1;
o break;
o }
o else if(x==2 && f[1].cnt<60)

Page No. 14
o {
o ch=2;
o break;
o }
o printf("wrong selection !!!\n");
o }
o if(ch==1)
o {
o currF=0;
o res();
o }
o else if(ch==2)
o {
o currF=1;
o res();
o }
o else
o {
o home();
o }
o }
o
o void home()
o {
o int x;
o printf("\n***WELCOME TO ADAH FLIGHT***\n");
o printf("1 for reservation\n2 for list\n0 for exit\n");
o x=100;
o while(x!=0)
o {
o scanf("%d",&x);
o switch(x){
o case 1:
o selF();
o x=0;
o break;
o
o case 2:

Page No. 15
o printList();
o x=0;
o break;
o
o default:
o x=0;
o break;
o }
o
o }
o }
o
o void main()
o {
o currF =0;
o pCnt=0;
o srand(time(0));
o f[0]=newf("ADAH");
o f[0].cnt=filled;
o f[1]=newf("ADAH -2");
o f[1].cnt=filled;
o home();
o }

Page No. 16

You might also like