汽车租赁系统

上传人:ail****e1 文档编号:45494373 上传时间:2021-12-07 格式:DOC 页数:4 大小:40KB
收藏 版权申诉 举报 下载
汽车租赁系统_第1页
第1页 / 共4页
汽车租赁系统_第2页
第2页 / 共4页
汽车租赁系统_第3页
第3页 / 共4页
资源描述:

《汽车租赁系统》由会员分享,可在线阅读,更多相关《汽车租赁系统(4页珍藏版)》请在装配图网上搜索。

1、实现租车汽车租赁系统,不同车型日租金情况如表 7-1所示;车型及日期轿车客车车型别克Gl8宝马750别克凯越19座日租金(元/天)7506005008001200编程实现计算不同车型不同天数的租赁费用。package zuche;public abstract class MotoVehicle privateStringno;privateStringbrand ;int fee = 750,600,500,800,1200;public MotoVehicle() public MotoVehicle(Stri ngno ,Stri ng brand) this . no=no; this

2、 . brand =brand ;public Stri ng getNo() return no;public Stri ng getBra nd() returnbrand ;public void setBrand(Stringbrand ) this . brand =brand ;public void setNo(Stringno) this . no=no;public void printInfo() System. out .println( * 汽车的信息 * +n 汽车品牌+this .brand +n 车牌号+this .no);public abstract void

3、 calRent( int days);package zuche;public class Car extends MotoVehicle private String type ;/String type仁别克凯越,宝马730,别克凯越,中小客车(19座以内),大型客车(19座以上);public Car() public Car(String no ,Stringbrand ,String type ) super ( no, brand );this . type =type ;public String getType() return type ;public void setTy

4、pe(String type ) this . type =type ;public void printInfo() /super.printInfo();/ 调用父类的构造方法,子类不能直接继承父类的 构造方法;System. out .println( * 汽车的信息 * +n 汽车品牌 +getBrand()+ n 型 号 +this . type +n 车牌号 +getNo(); public void calRent( int days) int rent =0;if ( 宝马 .equals(getBrand()rent =days *600; else if ( 别克 .equ

5、als(getBrand()& gl8 .equals( this . type ) rent =days *750;else rent =days *500;System. out .println( 你的租车费用为 +rent + 元 );package zuche;public class Bus extends MotoVehicle private int seatCount ;public Bus() public int getSeatCount() return seatCount ;public void setSeatCount( int seatCount ) this

6、. seatCount =seatCount ;public void printInfo() System. out .println( * 汽车的信息 * +n 车牌号+getNo()+ n 客车 座位数+this . seatCount +座);public void calRent(int days) int rent =0;if ( seatCount =19) rent =days*800; else rent =days *1200;System. out .println( 你的租车费用为+rent +元); package zuche;import java.util.Sca

7、nner;public class TestRent public static void main(Stringargs ) Sca nner in put =new Scann er(System. in ); /int carType;String answer;int day =0;Car c=new Car();Bus b=new Bus();*欢迎光临西树东花租车*);System. out .println( System. out .println(int random =(int )(Math. random ()*89999+10000);/random()的取值范围为0,

8、1);do System. out .println(轿车请选:1 +n 货车请选:2);c.setNo(黑At +random);if (input .nextInt()=1) System. out .println(请输入汽车的品牌(1.宝马、2.别克);switch (in put .n ext In t() case 1:c.setBrand(宝马);c.setType( 730);c. prin tI nfo();System. out .println(请输入租车天数);c.calRe nt( in put .n ext In t();break ;case 2:System.

9、out .println( 请选择别克车的类型: if ( input .nextInt()=1) c.setBrand( 别克 );c.setType( gl8 );c. printInfo();System. out .println( 请输入租车天数 );c .calRent(input .nextInt(); else c.setBrand( 别克 );c.setType( 凯越 );c. printInfo();System. out .println( 请输入租车天数 ); c .calRent(input .nextInt(); else System. out .println

10、( 请选择客车的座位数:b.setNo(黑A+random);switch ( input .nextInt() case 1: b.setSeatCount(17);b.printInfo();System. out .println( 请输入租车天数 ); b.calRent( input .nextInt(); break ;case 2:b.setSeatCount(21);b.printInfo();System. out .println( 请输入租车天数 ); b.calRent( input .nextInt(); break ;System. out .println( 是否继续租车 y/n );answer =input .next();while ( answer .equals( y );gl8 、凯越);19座下/19 座以上);欢迎下次光临 );if (answer .equals( n ) System. out .println(

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

copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!