使用Python实现一个小型的航空订票系统(1)

这次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.



你可能感兴趣的:(Python学习)