使用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.



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
#这只是一个半成品,只是实现了,一个完整的过程,对于,如果刷,自己研究 #简单过程 # 第一、getRandAndCookie() 获得cook 和一个随机数用于登录 # 第二、getEnterRandCode() 得到登录时的识别码 # 第三、setuseandpassword(randcode,use,password) 发送随机数、识别码和用户及密码。由于随机数只在内部使用,所以定义成了全局变量, # 第四、GetTrainList() 得到所有车站列表,'@bjb|北京北|VAP|beijingbei|bjb|0' 其中有中文、拼音、拼音缩写、所一个ID(唯一),其主要是可以,通过上面的列表,找到它的唯一ID,TranCityToId('南昌') # 第五、GetTrainNumList(date,fromstationid,tostationid,starttime) 得到哪到哪的所在车次,消息格式如下,其中所以,一下车次的的ID:"id":"650000K1060I" # {"end_station_name":"北京西","end_time":"16:18","id":"650000K1060I","start_station_name":"深圳","start_time":"10:54","value":"K106"} # 通过ChangeToTrainNumId('K106')得到车次ID # 第六、QueryTrain(fromstationid,tostationid,date,stationNum,starttime) 就是点击查询按键,得到是否有能预,格式如下 #       南昌         20:12,    北京西        07:38,11:26,--,--,--,--,10,有,有,--,有,有,--,<a name='btn130_2' class='btn130_2' # 通过choiceSubmitNum(stationNum,trainsubmitinfo)提取出getSelected()消息 # 第七、submitRequest(choiceSubmitNum(stationNum,trainsubmitinfo),date,starttime) 就是点击预按钮 # 第八、getrandCheckCode()得到提交单的识别码 # 第十、CheckInMyTicket(info,randcode,peoples)点击提交,如果成功的话,就会返回{"errMsg":"Y"} # 出于,网络是UTF8格式,所以,必须# -*- coding: utf-8 -*-,(当然,自己转换也是可以的) # 出于这一个控制台信息,所以,识别码的图片在脚本同一目录 #得到头信息

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值