You are on page 1of 16

Computer Science Project | Samridh Singh

COMPUTER
SCIENCE PROJECT
NAME – SAMRIDH SINGH

CLASS – 12TH A

ROLL NUMBER - 36

1
Computer Science Project | Samridh Singh

Acknowledgement

2
Computer Science Project | Samridh Singh

Acknowledgement

I would like to express my special thanks of


gratitude to my computer science teacher
Mrs. Monika Jain Ma’am, who gave this
oportunity to do this project on Creating a
Airline Pasangers management Sustem, based
on binary fines in python.

I would also like to extend my gratitude to my


parents, who helped me in compleating the
project in the given timeframe.

3
Computer Science Project | Samridh Singh

Introduction
My project is based on Data file management
of Binary Files in python.
The Python Program is Called Airline
Passenger Management System.
It enables airlines to effectively and simply
manage their Passengers data.

4
Computer Science Project | Samridh Singh

5
Computer Science Project | Samridh Singh

Airline Passengers Management


System
(Based on Binary File)

6
Computer Science Project | Samridh Singh

Python Code
import pickle
import random
import sys

def airline():
File_1 = open('Passenger_Database_new1.dat', 'ab')
flight_no = int(input("Enter the Flight Number: "))
Name = input("Enter the Name of Passenger: ")
Ticket_Number = random.randint(100000, 999999)
Time_Departure = int(input("Enter the Time of Departure: "))
Time_Arrival = int(input("Enter the Time of Arrival: "))
Departure_City = input('Enter the Name of Departure City: ')
Arrival_City = input("Enter the Name of Arrival City: ")

data = [flight_no, Name, Ticket_Number, Time_Departure, Time_Arrival,


Departure_City, Arrival_City]

pickle.dump(data, File_1)

7
Computer Science Project | Samridh Singh

pickle.dump('\n', File_1)
print("Successfully Made a ticket")
File_1.close()

def search():
Search = input("Do you want to view passenger's flight Information")
if Search == "Yes":
File_1 = open('Passenger_Database_new1.dat', 'rb')
m = pickle.load(File_1)

l = input("Enter Name: ")


y=1
try:
while True:

if m[1] == l:
print(m)
y=2
break
except:

8
Computer Science Project | Samridh Singh

File_1.close()

elif Search == "No":


print("Thank you for using Airline Passenger management System")

while True:

print("-------------------------------------------------------------")
print("-------------------------WELCOME-----------------------------")
print("------Welcome to the Airline Passenger management System-----")
print("-------------------------------------------------------------")

print("Press (1) to make a ticket\n"


"Press (2) to search a passenger's ticket\n"
"Press (3) to display the first booked ticket\n"
"Press (4) to create a new passenger database\n"
"Press (5) to exit")
choice = int(input("Enter your choice:"))
if choice == 1:
airline()

9
Computer Science Project | Samridh Singh

elif choice == 2:
search()
elif choice == 3:
File_1 = open('Passenger_Database_new1.dat', 'rb')
abc = pickle.load(File_1)
print(abc)
File_1.close()

elif choice == 4:
File_1 = open('Passenger_Database_new1.dat', 'wb')
flight_no = int(input("Enter the Flight Number: "))
Name = input("Enter the Name of Passenger: ")
Ticket_Number = random.randint(100000, 999999)
Time_Departure = int(input("Enter the Time of Departure: "))
Time_Arrival = int(input("Enter the Time of Arrival: "))
Departure_City = input('Enter the Name of Departure City: ')
Arrival_City = input("Enter the Name of Arrival City: ")

data = [flight_no, Name, Ticket_Number, Time_Departure, Time_Arrival,


Departure_City, Arrival_City]

pickle.dump(data, File_1)

10
Computer Science Project | Samridh Singh

print("Successfully Made a ticket")


File_1.close()

elif choice == 5:
sys.exit()

print("-----Thank you for using the Airline Passenger management System--


---")
print("----------------------Project by Samridh Singh-----------------------")

11
Computer Science Project | Samridh Singh

Output of the Code

12
Computer Science Project | Samridh Singh

13
Computer Science Project | Samridh Singh

14
Computer Science Project | Samridh Singh

15
Computer Science Project | Samridh Singh

16

You might also like