org.lanqiao.classpractice.carrentalsystem类图(优化和未优化和老师)
2018-05-03 13:15:35 42 举报
租车系统UML图
作者其他创作
大纲/内容
Person
-carNum:int-rentDays:int-totalRent:int-v[]:vehicle
老师的类图:不包含Person类,用到了继承和多态、
bus
-seatCount:int
+calcFee(dat:int):double+getRent(brand:string):double
-carNum:int-rentDays:int-totalRent:int-c[]:Car-b[]:Bus
vehicle
-license:String-dailyRent:int
car
-model:String
优化:抽象出父类,且客车不是按品牌来分而是按照座位数,按照单一设计原则,Sys中抽出了computeTotalRent方法
-vehicleNo:String
+calcFee(day:int):double
第一个版本:car和Bus都是按照品牌来分
Sys
-p:Person-carsInfo:String[][]-busInfo:String[][]
+welcome():void+Rent():void+displayRentInfo():void
Bus
-model:String-license:String-dailyRent:int
-brand:String
-vehicles:Vehicle[]
+welcome():void+selectVehicle():void+calcAllRent(day:int):double+print():void
+welcome():void+Rent():void+computeTotalRent():void+displayRentInfo():void
0 条评论
下一页