java汽车租赁系统_第1页
java汽车租赁系统_第2页
java汽车租赁系统_第3页
java汽车租赁系统_第4页
java汽车租赁系统_第5页
免费预览已结束,剩余2页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、-LProblemsJavadoc窗Dtclaratiorm 已厩it*Tt(6)Jm*a应用程序匚:口口学三三工代壬邑熨士三;送/人要和生土矢多;-3 人会胆灵的苴苦粪,1护书2,本缶1:1割4上 M气爵在左入室(芸号2幸壬::爆王建宙玉书丁ty/nl:n在力K牛出邕豆墟4A76936立国理口疸小莘,追空壬缴;*,三受毛;900阳Phjblenw|械Javadoc(匾Declaratkin|v 已蟋止户Test(_6Java在用是后C:Prog屿麻品汽主焦里善河;清戏,餐鞋营料W;f5黑肚A鬓屯江竹宜三美紫(工行至Zi等客;:2再*入饕程当物汽三岛电(1霍修之,里:2司*J一琴豆 M,空二工

2、,工是至近区程与:匚y/n):I土刍出与汽主基苣$A37180叁龙*名;小军/重金荚龙-5,*赏目-75WR.efttCar团 Bu5,j”日|JCar.javaFCustomer.javaJrvlotoVebicle.javaJrEtst.javajjTrjck.javapackageRentCar;publicclassBusextendsMotoVehicleprivateintseatCount;/构造方法publicBus()publicBus(Stringno,Stringbrand,intseatCount)super(no,brand);this.seatCount=seatC

3、ount;/获取座位数publicintgetSeat()returnseatCount;/计算租金publicintcalRent(intdays)intrent=0;if(seatCount=16)rent=800*days;elserent=1500*days;returnrent;packageRentCar;publicclassCarextendsMotoVehicleprivateStringtype;/轿车的型号/构造方法publicCar()publicCar(Stringno,Stringbrand,Stringtype)super(no,brand);this.type=

4、type;)/设置轿车的型号publicvoidsetType(Stringtype)this.type=type;/返回轿车型号publicStringgetType()returntype;/实现父类抽象方法,计算租金 publicintcalRent(intdays)intrent=0;if(宝马.equals(getBrand()rent=days*500;elseif(丰田.equals(getBrand()if(type.equals(GL8)rent=days*600;elserent=days*300;returnrent;packageRentCar;publicclassC

5、ustomerprivateStringname;publicCustomer()publicCustomer(Stringname)=name;publicStringgetName()returnname;publicintcalcTotalRent(MotoVehiclemoto,intintrent=0;for(inti=0;imoto.length;i+)if(motoi!=null)rent=rent+motoi.calRent(days);returnrent;packageRentCar;publicabstractclassMotoVehicleprivat

6、eStringno;/车牌号privateStringbrand;/品牌/构造方法publicMotoVehicle()days)publicMotoVehicle(Stringno,Stringbrand)this.no=no;this.brand=brand;/返回机动车辆的牌照publicStringgetNo()returnno;/返回机动车辆的品牌publicStringgetBrand()returnbrand;/计算租金的抽象方法publicabstractintcalRent(intdays);packageRentCar;importjava.util.Scanner;int

7、seat;/座位数Stringno;/拍照Stringanswer;/是否继续newMotoVehicle10;newCustomer(小明);System.out.print(days=input.nextInt();doSystem.out.print(请输入要租赁的汽车类型(1.轿车 2.客车):);publicclassTestpublicstaticvoidScannerinput=intdays=0;intmotoType;Stringbrand;Stringtype=main(String 口 args)newScanner(System.in)/租赁的天数/汽车大类型/汽车品牌

8、null;/汽车具体类型MotoVehiclemoto=Customercustomer=System.out.println(”欢迎来到汽车租赁公司!);请输入要租赁的天数:);motoType=input.nextInt();intrandom=(int)(Math.random()*(99999-10000)+10000);switch(motoType)case 1:no=粤 A+random;/车辆牌照System.out.print(请输入要租赁的汽车品牌(1.宝马 2.丰田):);if(input.nextInt()=1)brand=宝马;type=320i;elsebrand=

9、丰田;type=RAV4;/实例化一个轿车对象,并添加到 moto 数组中for(inti=0;imoto.if(motoi=motoi=break;break;case 2:no=粤 A+random;System.out.print(请输入要租赁的汽车品牌(1.黄海 2.金龙):);根据选择得到汽车品牌if(input.nextInt()=1)brand=黄海;elsebrand=金龙;System.out.print(请输入客车的座位数:);seat=input.nextInt();/汽车座位数/实例化一个轿车对象,并添加到 moto 数组中for(inti=0;imoto.length

10、;i+)length;i+)null)newCar(no,brand,type)if(motoi=null)motoi=newBus(no,brand,seat);象break;break;System.out.print(是否继续租车?(y/n):);answer=input.next();while(answer.equals(y);System.out.println(汽车牌号t 汽车品牌);for(inti=0;imoto.length;i+)if(motoi!=null)if(motoiinstanceofCar)Carc=(Car)motoi;System.out.println(c.getNo()+t+c.getBrand();elseBusb=(Bus)motoi;System.out.println(b.getNo()+t+b.getBrand();System.out.println(客户名:+customer.getName()+,租赁天数:总费用:+customer.calcTotalRent(moto,days);packageRentCar;publicclassTruckextendsMotoVehicleprivateintweight;/吨位publicTruck()publicTruck(Stringno

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论