0% found this document useful (0 votes)
428 views22 pages

Airline Reservation System

The document describes a mini-project to create an airline reservation system using C language. It includes an introduction to C language and why it was used for the project. It then explains the project which is to design a program to assign seats on flights with a maximum capacity of 15 seats. The program should not assign seats that are already booked and display a message if the flight is full. It should also allow passengers to cancel their booking by entering their passport number. Flowcharts and pseudocode are provided to illustrate the logic and functions of the reservation, cancellation, and display functions. Finally, sample C source code is given to implement the project.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
428 views22 pages

Airline Reservation System

The document describes a mini-project to create an airline reservation system using C language. It includes an introduction to C language and why it was used for the project. It then explains the project which is to design a program to assign seats on flights with a maximum capacity of 15 seats. The program should not assign seats that are already booked and display a message if the flight is full. It should also allow passengers to cancel their booking by entering their passport number. Flowcharts and pseudocode are provided to illustrate the logic and functions of the reservation, cancellation, and display functions. Finally, sample C source code is given to implement the project.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

AIRLINE RESERVATION SYSTEM

MINI-PROJECT S1

SRMIST CSE AI ML
18CSS101J-NALLARASAN SIR
MINI PROJECT - C LANGUAGE
SRMIST 1ST YEAR – CSE AI & ML (S1)
PROGRAMMING FOR PROBLEM-SOLVING

TITLE : AIRLINE RESERVATION SYSTEM


NAMES-ID : Prakhya Pragnya Shri-RA2111026010004
Shashank Reddy.A -RA2111026010028
Sanjay.G-RA2111026010025
Armaan Parnami-RA2111026010019

Introduction

Originally, the C language is developed from two previous languages, BCPL and
B. BCPL which were developed in 1967 by Martin Richards as a language for wringing
operating systems and compilers. C was evolved from B by Dennis Ritchie at Bell
Laboratories and it was implemented in 1972. It initially became widely known as the
development language of the UNIX operating system. Lots of today’s leading operating
systems are written in C and C++. C language is mostly hardware independent as it is
possible to write C programs that are portable to most computers.

Why we use c language C has been used successfully for each kind of programming
problem thinkable from operating systems to spreadsheets to expert systems - and efficient
compilers are accessible for machines ranging in power from the Apple Macintosh to the
Cray supercomputers. the largest measure of C's success appears to be based on strictly
sensible considerations:

The standard library concept;

the ease with that applications can be optimized by hand-coding isolated procedures;

a powerful and varied repertoire of operators;

the portability of the compiler;


Project Explanation:

The project is Airline Reservation System:

Our main aim is to write a program to assign seats on each flight of the airlines
only place (capacity: 15 seats).

The program should never assign a seat that is already assigned. If there’s no seat
available, then print the message " the flight is full ".

After the flight is full and someone wants to cancel the booking, it is displaying enter you’re
the passport number you want to cancel it so after the passenger cancels it, the system
directly free that place if someone wants to book that seat.

Moreover, the system should bring a boarding pass indicating the persons' name, passport
number, and seat number as each seat is assigned, set the corresponding elements of the
array to 1 to indicate that the seat is no longer available.
FLOW CHART

1.Main menu

Start

Declare Choice

Print
“welcome to
our airlines”

Print
“Airline Seat
Selection
1.Reservation
2.Cancel
3.Dispaly layout
4.Exit

accept choice

NO NO
NO NO PRINT
choice = 2
choice = 1 choice = 3 choice = 4 "INVALID
CH"
YES
YES YES YES

R C D E

STOP

When the program is started, the user will direct to the main menu. The user will be
required to select one of the four options.
2.Reservation and 3.cancel functions

Declare seats = 10
,firstname,lastname Declare
,passport.no passport.no

Print "Enter
your
Sorry no NO passport.no:"
seats If seats <10
available

Accept passport
YES number

Seats = seats+1

YES print"not
Enter firstname End of records
found"
Enter lastname
Enter
passport.no
NO

Accept NO passport.no=
Read next record
Firstname,Lastname, record_passport.no?
passport.no

print
"booked Delete record
successfully"
YES

RTN
RTN

These are the flowcharts for the reservation and cancel functions
4.Displaying Function.

NO
End of records? Display seats read next record

YES

RTN

That is the flowchart for the displaying function


Pseudocode

Begin
Declare Choice Repeat
repeat
display “welcome to our airlines”
display “Airline Seat Selection
1.Reservathion
2.Cancel
3.Dispaly layout
4.Exit
Enter your choice”
Accept choice
If (choice = 1)
Call R ()
Else
If (choice = 2)
Call C ()
Else
If (choice = 3)
Call D ()
Else
If (choice = 4)
Call E ()
Else
Print “Invalid choice”
End-If

End-If
End-If

End-If

Until (choice <> 4)

End

Function reservation ()

Declare passport number, name, num, email, contact number

Print “Enter your passport number”

Accept passport number

Print “Enter your name”

Accept name

Print “Enter your email “

Accept email

Print “Enter your contact number”

Accept contact number

IF (seats >15)

Print No Seats Available

ELSE

IF

(Seats <=15)

Print “registered successfully”

END-IF
END-IF

END-FOR

Return

Function Cancel ()

Declare Passport number

Print “Enter passport number to delete record”

Accept passport number

Do while (not end of records)

IF (passport = record _passport)

Delete record

Return

END-IF

Read next record

END-do

print

Return

Function Display layout ()

Do while (not end of records)

Display Record

Read next record

End -do

Return
C source code
#include<stdio.h>

#include<stdlib.h>

#include<conio.h>

#include<string.h>

struct srm_airline

{ char passport[6];

char name[15];

int seat_num;

char email[15];

struct srm_airline*following;

*begin,*stream;

struct srm_airline*dummy;

void main()

{ void reserve(int x),cancel(),display(),savefile();

int choice;

begin=stream=NULL;

int num=1;

do

{printf("\n\n\t\t *****************************************");

printf("\n\t\t ******Welcome to SRM AIRLINE SYSTEM******");

printf("\n\n\n\t\t Please Enter your choice from below(1-4):");

printf("\n\n\t\t 1.RESERVATION");

printf("\n\n\t\t 2.CANCEL");

printf("\n\n\t\t 3.DISPLAY RECORDS");

printf("\n\n\t\t 4.EXIT");

printf("\n\n\t\t Feel free to ask us-");


printf("\n\n\t\t Enter your choice:");

scanf("%d",&choice); fflush(stdin);

system("cls");

switch(choice)

case 1:

reserve(num);

num++ ;

break;

case 2:

cancel();

break;

case 3:

display();

break;

case 4:

{ savefile();

break;

default:

printf("\n\n\t SORRY INVALID CHOICE");

printf("\n\n\t PLEASE CHOOSE FROM 1-4");

printf("\n\n\t Do not forget to choose from 1-4");

getch();

} while (choice !=4);

//*GOOD LUCK**//

void details()

{
printf("\n\t Greetings!");

gets(stream->passport); fflush(stdin);

printf("\n\t Enter your passport number:");

gets(stream->passport); fflush(stdin);

printf("\n\t Enter you Name:");

gets(stream->name); fflush(stdin);

printf("\n\t Enter your Email address:");

gets(stream->email); fflush(stdin);

//*GOOD LUCK**//

void details();

void reserve(int x)

{ stream=begin;

if (begin==NULL)

//First User//

begin=stream=(struct srm_airline*)malloc(sizeof(struct srm_airline));

details();

stream->following=NULL;

printf("\n\t Seat Booking Succesful!");

printf("\n\t Your seat number is: Seat A-%d",x);

stream->seat_num=x;

return;

else if(x>15)

printf("\n\n Seats Full");

return;

else
{

//next User

while(stream->following)

stream=stream->following;

stream->following=(struct srm_airline*)malloc(sizeof(struct srm_airline));

stream=stream->following;

details();

stream->following=NULL;

printf("\n\t Seat Booking Succesful!");

printf("\n\t Your seat number is: Seat A-%d",x);

stream->seat_num=x;

return;

//*GOOD LUCK**//

void savefile()

{ FILE*fpointer=fopen("airline records","w");

if (!fpointer)

{ printf("\n Error in opening file");

return;

stream=begin;

while (stream)

{ fprintf(fpointer,"%-6s",stream->passport);

fprintf(fpointer,"%-15s",stream->name);

fprintf(fpointer,"%-15s",stream->email);

stream=stream->following;

printf("\n\nt Details have been saved to a file(airline records)");

fclose(fpointer);
}

//*GOOD LUCK**//

void display()

{ stream=begin;

while(stream)

printf("\n Passport Number:%-6s",stream->passport);

printf("\n Name:%-15s",stream->name);

printf("\n Email address:%-15s",stream->email);

printf("\n Seat number: A-%d",stream->seat_num);

printf("\n\n++=============================================================++");

stream=stream->following;

//*GOOD LUCK**//

void cancel()

stream=begin;

system("cls");

char passport[6];

gets(passport); fflush(stdin);

printf("Enter Passport number to delete record?:");

gets(passport); fflush(stdin);

if (strcmp(begin->passport,passport)==0)

dummy=begin;

begin=begin->following;

free(dummy);

printf("Booking has been deleted");

return;
}

while(stream->following)

if(strcmp(stream->following->passport,passport)==0)

dummy=stream->following;

stream->following=stream->following->following;

free(dummy);

printf("Booking has been deleted");

getch();

return;

stream=stream->following;

printf("Passport Number is wrong PLEASE check your passport");

//*GOOD LUCK**/
REPORT

Main Menu

When the program is executed, the user will be directed to the main menu interface. The
program is introduced with a few lines of text. Then four selections are made for the user
as the user can choose to reserve, cancel, display or exit the program.

Invalid value

. If the user accidentally enters an invalid input, an interface will be shown to notify the
user to choose again and it notify the user again to enter from 1-4.
reservation function

The program is asking the user to enter passport number, name, and email address to
reserve a seat for the user and the seat cannot be book for anyone else.

seat has successfully booked

As shown in the interface the seat reservation has been booked successfully, after the user
has entered the details.
15 is the maximum seat number

The program could not book any more seat

After registering 15 users in the system now the flight is supposed to be full and cannot
except anymore.

no more seat available

The system will pop out to notify the user that there’s no seat available, the flight
contains only 15 seat after that it is displaying it is full sorry we cannot register anymore.
cancel function

After the passenger entered 3 and want to cancel the record, after that, the program
requires the user to enter which passport number to delete it. For example, that Person A
registered the seat on the flight and he wants to cancel it.

The system askes A to enter his passport number to cancel it from the system without any
problems and in an efficient way. After “A” entered his passport number the system pop in your
record has been deleted from the system.

If “A” entered the wrong passport number by mistake the system pop in hey passport
number is wrong, please check your passport number and enter it again.
The interface is displaying all the user’s records that now you have two seats Ahmed with
his details and “A” with his details as well. There’s a line between the users to make it
clear to read and do not misunderstand it.

display function

After “A” cancel his seat from the system, the interface is showing that only One person
is in the system and A’s seat already deleted.
after entered 4 which is exit function, it is storing all the records into file with all the passenger’s
details in Airline record.

The interface is showing the record in notepad which is the storing part and it is displaying ahmed
and his details after “A” cancel his record.
Conclusion
The Airline reservation system is designed for users to reserve a seat, cancel,
display seats and exit the system. A formula is included in the function to calculate the
seats are reserved. Pseudocode is written for some important codes. A few flow charts are
also created for explaining the process of the Airline reservation system.

From this Project, I have learned to implement a few C concepts in future projects
such as functions, switch statements and do…while statements, arrays, pointers, and
structures in the program. I have also learned to create flow charts for explaining the
program.

~THANK YOU!

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy