这次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:
-
Providean implementation of all the classes.
-
Inthe mainmethod ofTravelAgency class:
-
createfour instancesof Airplane(such asA380)
-
createcertain numberof Seatfor eachairplane (suchas F4)
-
createtwo instancesof AirlineCompany(such asAmerican Airline)
-
assignairplanes toairline companies
-
createinstances offive customers
-
alloeevery customerbuy twotickets
-
-
Inthe displayTickets()method, foreach airplane:
-
displaythe airlinecompany nameof theticket
-
displaythe airplaneinformation ofthe ticket
-
displaythe seatsinformation inthe airplane
-
displaythe nameof passengerif theseat isnot vacancy
-
Thefull namein ticketisairlineCompany.getID()+airplane.getID()+seat.getID().
Forinstance, UA888F4 meansairline companyid “UA”,airplane id“888” andseat id“F4”.
-
Inthe displayCustomer() method,for eachcustomer display:
-
Thecustomer nameand age
-
Thetickets thatthe customerbought
-
Hint:
Butwhen wedo notwant todisplay students’information fora givencourse
Thedifference iswhen astudent wantsto registera course,he/she hasto putthe courseobject inenrolls[] arrayand put“student.this” tohave[] arrayfor thefirst figure.We justneed toput courseobject inenrolls[] arrayfor thesecond figure.
本次作业要求使用Python实现旅行代理模型,包括创建飞机、座位、航空公司和顾客实例,并展示机票信息。具体步骤包括创建飞机、分配座位、航空公司、顾客实例,以及显示机票和顾客购买的票详情。
614

被折叠的 条评论
为什么被折叠?



