使用Python實現一個小型的航空訂票系統(1)

鴨脖發表於2012-05-16

這次ssd9老師佈置了一個作業,xiandedanteng,所以我就用python簡單的寫了一下,大家可以參考一下:

要求如下:

Homework#2



  • SendthesoftcodeofyourmodeltotheemailaddressoftheTA

  • Nolate submission will be accepted


Implementthe classesas shownin thefollowing diagram.You canuse anyprogramming languagewhich supportsobject orientedprogramming suchas Java/C++for implementation.



Youneed to:


  1. Providean implementation of all the classes.


  1. Inthe mainmethod ofTravelAgency class:

    1. createfour instancesof Airplane(such asA380)

    2. createcertain numberof Seatfor eachairplane (suchas F4)

    3. createtwo instancesof AirlineCompany(such asAmerican Airline)

    4. assignairplanes toairline companies

    5. createinstances offive customers

    6. alloeevery customerbuy twotickets

  2. Inthe displayTickets()method, foreach airplane:

    1. displaythe airlinecompany nameof theticket

    2. displaythe airplaneinformation ofthe ticket

    3. displaythe seatsinformation inthe airplane

    4. displaythe nameof passengerif theseat isnot vacancy


Thefull namein ticketisairlineCompany.getID()+airplane.getID()+seat.getID().

Forinstance, UA888F4 meansairline companyidUA,airplane id888andseat idF4.


  1. Inthe displayCustomer() method,for eachcustomer display:

      1. Thecustomer nameand age

      2. Thetickets thatthe customerbought



Hint:


Butwhen wedo notwant todisplay studentsinformation fora givencourse



Thedifference iswhen astudent wantsto registera course,he/she hasto putthe courseobject inenrolls[] arrayand putstudent.thistohave[] arrayfor thefirst figure.We justneed toput courseobject inenrolls[] arrayfor thesecond figure.



相關文章