Project This Assignment simulates a basic flight booking system. The system must allow the addition of customers and flights. It must also allow the booking of flights by existing customers. The...

1 answer below »
PLEASE FIND THE ATTACHED FILE


Project This Assignment simulates a basic flight booking system. The system must allow the addition of customers and flights. It must also allow the booking of flights by existing customers. The following functionality must be available from a menu. Add Customer Add flight Add Booking View flights View Customer View Flight Exit ADD CUSTOMER This option should ask for all the information required to make a customer object and add it to a list of customers. ADD FLIGHT This option should ask for all the information required to make a Flight object and add it to a list of flights. ADD BOOKING When the “Add booking” option is selected, a list of all customers and all flights should be displayed first. The user must then be asked for the Customer id and flight id to make the booking for. A booking can only be made if there is free space on the plane, the customer id exists and the flight id exists. All associated objects should be updated. An appropriate message as to whether the booking was successful or not should be displayed. VIEW FLIGHTS When “View flights” is selected, the flight number ,origin and destination for each flight must be shown. VIEW CUSTOMERS When “View customer” is selected a list of all th customer numbers and their names must me displayed.. VIEW FLIGHT When “View flight” is selected, a list of all the flight number must be presented. The user must then be asked to choose one. The flight details with that flight number must be displayed. If the flight is not found, an appropriate message must be shown. EXIT When “Exit” is selected, a departing message thanking the user for using your system must be displayed The Flight and Customer classes will be used to create objects that hold the information for a particular flight and customer respectively. NOTE: Getters for all state of the Flight and Customer classes must be added. Customer -customerId : int -firstName :string -lastName :string -phone :string +Customer(id,fName,lName,ph) Flight -flightNumber : int -origin :string -destination : string -masSeats : int -numPassengers : int +Flight(flightNo,orig,dest,mSeats) +addPassenger(cust:Customer):bool +findPassenger(custId : int): int +removePassenger(custId : int):bool +getPassengerList(): string Special Notes: The flight.__str__ method must print all the flight information followed by all the names of the passengers on that flight.
Answered Same DayJul 23, 2021

Answer To: Project This Assignment simulates a basic flight booking system. The system must allow the addition...

Yogesh answered on Jul 25 2021
138 Votes
# customers list & flights list to store customers & flights objects
customers = []
flights = []
def menu():
    print("="*35)
    print("1. Add Customer")
    print("2. Ad
d Flight")
    print("3. Add Booking")
    print("4. View Flights")
    print("5. View Customer")
    print("6. View Flight")
    print("7. Exit")
    
    ip = input("Select an option [1-7] : ")
    
    if ip == "1":
        addCustomer()
    elif ip == "2":
        addFlight()
    elif ip == "3":
        addBooking()
    elif ip == "4":
        viewFlights()
    elif ip == "5":
        viewCustomer()
    elif ip == "6":
        viewFlight()
    elif ip == "7":
        print("\nThank you...!!!")
        input()
        exit()
    else:
        print("Invalid option...\n")
        menu()
    
# customer class
class Customer:
    def __init__(self, id, fName, lName, ph):
        self.customerid = id
        self.firstName = fName
        self.lastName = lName
        self.phone = ph
        
    def getid(self):
        return str(self.customerid)
    
    def getfName(self):
        return self.firstName
        
    def getlName(self):
        return self.lastName
        
    def getph(self):
        return self.phone
# flight class        
class Flight:
    def __init__(self, flightNo, orig, dest, mSeats):
        self.flightNumber = flightNo
        self.origin = orig
        self.destination = dest
        self.masSeats = mSeats
        self.numPassengers = 0
        
        # passengers list to store all passengers for the flight
        self.passengers = []
        
    def getFNo(self):
        return str(self.flightNumber)
        
    def getorig(self):
        return self.origin
    def getdest(self):
        return self.destination
        
    def getmSeats(self):
        return str(self.masSeats)
        
    def getNPass(self):
        return str(self.numPassengers)
        
    def addPassenger(self, cust):
        if self.numPassengers <...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here