[go: up one dir, main page]

0% found this document useful (0 votes)
44 views20 pages

FLIGHT BOOKING Project

Uploaded by

jeansmom944
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views20 pages

FLIGHT BOOKING Project

Uploaded by

jeansmom944
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

RISHIKUL VIDYAPEETH ALIPUR DELHI

Affiliated to Central Board Of


SecondaryEducation

INFORMATICS PRACTICES (065)


AIR TICKET BOOKING
(PROJECT FILE)

SUBMITTED BY: SUBMITTED TO:


Yash Mr.Indraprakash

ROLL NO:

CLASS: XII Science


ACKNOWLEDGEMENT

I would like to express my sincere gratitude to all


those who have helped me in completing this
(IP) practical. First and foremost, I would like to
thank my teacher, Mr Indraprakash Srivastav
whose guidance, expertise, and constant
encouragement made this practical assignment
both interesting and educational.
I would also like to extend my thanks to my
classmates and peers for their collaborative
support and assistance during the practical
exercises. Their insights and discussions greatly
enriched my understanding of the subject.
Finally, I would like to thank Rishikul Vidyapeeth
Alipur Delhi for providing the resources and
infrastructure necessary to conduct this practical and
gain valuable hands-on experience with Information
Practices concepts.
CERTFICATE

This is to certify that Yash has successfully


completed the practical assignment for the
Information Practices (IP) course at
Rishikul Vidyapeeth Alipur Delhi. The
practical was conducted under the guidance of
Mr.
Indraprakash Srivastav, whose invaluable
expertise and encouragement made this
assignment an enriching learning experience.
The practical involved the exploration and
application of key concepts in Information
Practices, and through this hands-on experience,
the student demonstrated an understanding of the
subject matter.
We appreciate the collaborative efforts of the
student's classmates and peers, whose support
contributed to the success of this practical.
External Examiner Subject Teacher Principal

INDEX

S.No. TITLE PAGE NO REMARKS

01 Introduction

02 Objective

03 System Requirements

04 Source Code

05 Output

06 Conclusion

07 Reference
INTRODUCTION

The Air Ticket Booking System is a Python-


based project designed to simulate a simple
airline ticket reservation system. It integrates
Python with SQLite for database management to
store flight details and booking records
efficiently.
Key Features:
1.View Available Flights: Users can see a list
of all available flights, including details such
as airline, departure and arrival cities, times,
and ticket prices.
2.Book Tickets: Users can book a ticket for a
selected flight by providing their name and
the flight ID.
This project is suitable for Class 12
Information Practices as it demonstrates
practical applications of Python and SQL.
OBJECTIVE

The primary objective of this project is to develop an


Air Ticket Booking System that provides a user-
friendly interface for managing flight bookings. This
system aims to demonstrate the integration of
Python programming with SQL databases,
highlighting practical applications of these
technologies in real-world scenarios.
Specific Objectives:
1.Simplify Flight Management: Provide users
with an easy way to view available flights and
their details, including airline name,
departure/arrival cities, timings, and ticket
prices.
2.Streamline Booking Process: Enable users to
book tickets by entering basic details, ensuring a
seamless and efficient process.
SYSTEM REQUIREMENTS

1. Hardware Requirements

• Processor: Intel i3 or higher


• RAM: Minimum 4GB (8GB recommended for
smooth processing)
• Storage: At least 500MB of free space for
Python installation, libraries, and temporary data
storage
• Operating System: Windows, macOS, or Linux

2. Software Requirements
• Programming Language: Python 3.6 or higher
• Libraries and Dependencies:
o Pandas: For data manipulation and analysis
oNumPy: For numerical operations (optional
but useful for advanced calculations
SOURCE CODE

# Air Ticket Booking System

# Importing required modules


import sqlite3
from datetime import datetime

# Setting up the SQLite database


def initialize_database():
conn = sqlite3.connect('airline_booking.db')
cursor = conn.cursor()

# Creating tables
cursor.execute('''CREATE TABLE IF NOT
EXISTS flights (
flight_id INTEGER PRIMARY
KEY,
airline_name TEXT,
departure TEXT,
arrival TEXT,
departure_time TEXT,
arrival_time TEXT,
price REAL)''')

cursor.execute('''CREATE TABLE IF NOT


EXISTS bookings (
booking_id INTEGER
PRIMARY KEY,
passenger_name TEXT,
flight_id INTEGER,
booking_date TEXT,
FOREIGN KEY (flight_id)
REFERENCES flights(flight_id))''')
# Adding sample flight data
cursor.executemany('''INSERT OR IGNORE
INTO flights (flight_id, airline_name, departure,
arrival, departure_time, arrival_time, price)
VALUES (?, ?, ?, ?, ?, ?, ?)''', [
(1, "Air India", "Delhi",
"Mumbai", "10:00", "12:00", 5000.0),
(2, "IndiGo", "Mumbai",
"Chennai", "14:00", "16:30", 4000.0),
(3, "SpiceJet", "Bangalore",
"Kolkata", "18:00", "21:00", 4500.0)])

conn.commit()
conn.close()

# Function to view available flights


def view_flights():
conn = sqlite3.connect('airline_booking.db')
cursor = conn.cursor()
cursor.execute("SELECT * FROM flights")
flights = cursor.fetchall()

print("\nAvailable Flights:")
print("Flight ID | Airline | From | To |
Departure | Arrival | Price")
for flight in flights:
print(f"{flight[0]} | {flight[1]} | {flight[2]} |
{flight[3]} | {flight[4]} | {flight[5]} |
{flight[6]}")

conn.close()

# Function to book a ticket


def book_ticket():
passenger_name = input("Enter your name: ")
view_flights()
flight_id = int(input("Enter the Flight ID you
want to book: "))
booking_date = datetime.now().strftime("%Y-
%m-%d %H:%M:%S")

conn = sqlite3.connect('airline_booking.db')
cursor = conn.cursor()

try:
cursor.execute("INSERT INTO bookings
(passenger_name, flight_id, booking_date)
VALUES (?, ?, ?)",
(passenger_name, flight_id,
booking_date))
conn.commit()
print("\nBooking successful!")
except sqlite3.Error as e:
print("\nError: Unable to book the ticket.",
e)

conn.close()

# Function to view bookings


def view_bookings():
conn = sqlite3.connect('airline_booking.db')
cursor = conn.cursor()
cursor.execute("SELECT * FROM bookings")
bookings = cursor.fetchall()

print("\nYour Bookings:")
print("Booking ID | Name | Flight ID | Date")
for booking in bookings:
print(f"{booking[0]} | {booking[1]} |
{booking[2]} | {booking[3]}")
conn.close()

# Main menu
def main_menu():
initialize_database()
while True:
print("\n--- Air Ticket Booking System ---")
print("1. View Flights")
print("2. Book a Ticket")
print("3. View Bookings")
print("4. Exit")

choice = input("Enter your choice: ")


OUTPUT

--- Air Ticket Booking System ---


Main Menu
markdown
Copy code
--- Air Ticket Booking System ---
1. View Flights
2. Book a Ticket
3. View Bookings
4. Exit
Enter your choice: 1
Viewing Flights
yaml
Copy code
Available Flights:
Flight ID | Airline | From | To | Departure |
Arrival | Price
1 | Air India | Delhi | Mumbai | 10:00 |
12:00 | 5000.0
2 | IndiGo | Mumbai | Chennai | 14:00 |
16:30 | 4000.0
3 | SpiceJet | Bangalore| Kolkata | 18:00 |
21:00 | 4500.0
Booking a Ticket
yaml
Copy code
Enter your name: John Doe
Available Flights:
Flight ID | Airline | From | To | Departure |
Arrival | Price
1 | Air India | Delhi | Mumbai | 10:00 |
12:00 | 5000.0
2 | IndiGo | Mumbai | Chennai | 14:00 |
16:30 | 4000.0
3 | SpiceJet | Bangalore| Kolkata | 18:00 |
21:00 | 4500.0
Enter the Flight ID you want to book: 2

Booking successful!
Viewing Bookings
yaml
Copy code
Your Bookings:
Booking ID | Name | Flight ID | Date
1 | John Doe | 2 | 2024-12-18 14:30:00
Exit
sql
Copy code
--- Air Ticket Booking System ---
1. View Flights
2. Book a Ticket
3. View Bookings
4. Exit
Enter your choice: 4

Thank you for using the Air Ticket Booking System!


CONCLUSION

The Air Ticket Booking System project


effectively demonstrates the integration of
Python programming and SQL database
management to create a functional application
for booking airline tickets. Through features
like viewing available flights, booking tickets,
and managing bookings, this project provides
hands-on experience with database operations
and Python programming concepts.

This project not only serves as a practical


learning tool for students but also illustrates the
foundational elements of real-world
applications used in the travel and aviation
industry. It highlights the importance of
structured data handling, user interaction, and
streamlined processes in software development.
REFRENCES

The data used in the Air Ticket Booking System


project is fictional and created for educational
purposes. Here's a breakdown of the data
sources:
1.Flight Information
o Airline names, flight routes,
departure/arrival times, and ticket prices
were designed as sample data to demonstrate
the functionality of the system.
o These details do not correspond to actual
airlines or flight schedules.
2.Database Design
o The database schema (tables for flights and
bookings) was structured based on common
practices in booking systems, taking
inspiration from tutorials and examples
available on Python and SQL learning
platforms like W3Schools and Real Python.
3.Booking Details
o User-provided inputs such as passenger
names and selected flight IDs are collected
during runtime and stored dynamically in
the SQLite database.
The purpose of this project is to showcase the
practical integration of Python and SQL, and all
data included is for simulation only. If you'd like
to use real-world data or modify the dataset, let
me know!

You might also like