python 面向对象编程实例练习:航班预订系统

要求:创建一套预订航班的预订系统。不同航班坐位收费不一样。 譬如头等舱要比经济舱贵。记录下何时有空房可供预订。

类的需求:用户类、用户管理类、航班类、航班管理类、订票系统

#乘客类:姓名,年龄,预定航班,余额(balance)
class Passenger:
    def __init__(self,name="",age=20,flight=[],balance):
        self.name=name
        self.age=age
        self.flight=flight
        self.balance=balance
    def setname(self,name):
    def setbalance(self,balance):
    def getflight(self):
    def getbalance(self):

 

#用户管理类
class PassengerManager:
    def __init__(self):
        self.passenger=[]
    def addpassenger(self,passenger):
    def delpassenger(self,passenger):
    def findpassger(self,name):
    def getpassenger(self):
        

 

#航班信息类:航班号,起飞地点,降落地点,日期,起飞和降落时间,不同等级位置的余票数和票价
class FlightInfomation:
    def __init__(self,index,startcity,endcity,date,starttime,endtime,firstticket,fisrtprice,seconodticket,secondprice):
        self.index=index
        self.startcity=startcity
        self.endcity=endcity
        self.date=date
        self.starttime=starttime
        self.endtime=endtime
        self.firstticket=firstticket
        self.fisrtprice=firstprice
        self.seconodticketsecondticket
        self.secondprice=secondprice
    def setdate(self,date):
    def setstarttime(self,starttime):
    def setendtime(self,endtime):
    def setfirstprice(self,firstprice):
    def setsecondprice(self,secondprice):
    def getindex(self):
    def getstartcity(self):
    def getendcity(self):
    def getdate(self):
    def getstarttime(self):
    def getendtime(self):
    def getfirstticket(self):
    def getfisrtprice(self):
    def getseconodticket(self):
    def getsecondprice(self):

 

#管理航班类
class FlightManager:
    def __init__(self):
        self.flight=[]
    def addflightinfo(self,flightinformation):
    def delflightinfo(self,flightinformation):
    def changeflightinfo(self,index,date,flightinformation):
    def findflight_ind(self,index,date):
    def findfligth_city(self,startcity,endcity):

 

class system:
    def __init__(self,flightmanager,passengermanager):
        self.flight=flightmanager.flight
        self.passenger=passengermanager.passenger
    def BuyTicket(self,passenger,flightinformation):
    def ReturnTicket(self,passenger,flightformation):

 

你可能感兴趣的:(python 面向对象编程实例练习:航班预订系统)