0% found this document useful (0 votes)
4 views1 page

Booking

The document defines a FlightTicketBooking class that allows users to book flight tickets between specified cities. It prompts the user for personal details and travel information, displays available flight options, and calculates the total cost based on the number of tickets. Finally, it confirms the booking with a summary of the details provided by the user.

Uploaded by

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

Booking

The document defines a FlightTicketBooking class that allows users to book flight tickets between specified cities. It prompts the user for personal details and travel information, displays available flight options, and calculates the total cost based on the number of tickets. Finally, it confirms the booking with a summary of the details provided by the user.

Uploaded by

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

class FlightTicketBooking:

def __init__(self):
self.flights = {
"Delhi-Mumbai": {"flight_no": "FM101", "price": 2000},
"Mumbai-Delhi": {"flight_no": "FM102", "price": 2000},
"Chennai-Kolkata": {"flight_no": "CK101", "price": 2000},
"Kolkata-Chennai": {"flight_no": "CK102", "price": 2000},
}

def book_ticket(self):
full_name = input("Enter your full name: ")
departure_city = input("Enter departure city: ")
destination_city = input("Enter destination city: ")
travel_date = input("Enter travel date (dd-mm-yyyy): ")
num_tickets = int(input("Enter number of tickets: "))

flight_route = f"{departure_city}-{destination_city}"
available_flights = [route for route in self.flights
if route.startswith(departure_city + "-")
or route.endswith("-" + destination_city)]

print("Available Flight Options:")


for i, flight in enumerate(available_flights):
flight_details = self.flights[flight]
print(f"{i+1}. Flight No: {flight_details['flight_no']}, Route:
{flight}")

choice = int(input("Enter choice number: ")) - 1


selected_flight = available_flights[choice]
flight_details = self.flights[selected_flight]
total_cost = num_tickets * flight_details["price"]

confirmation = f"""
Flight Ticket Confirmation for Under25 App user - e/bunny1201:
Passenger Name: {full_name}
Flight Route: {selected_flight}
Travel Date: {travel_date}
Total Cost: ₹{total_cost}
"""
print(confirmation)

if __name__ == "__main__":
booking_system = FlightTicketBooking()
booking_system.book_ticket()

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