java汽车油耗计算_JAVA面向对象编程-试卷B

这是一份关于Java面向对象编程的试卷,涉及交通工具类Traffic的定义,包括车轮数量、行驶速度属性及行驶方法。试卷要求定义汽车类Car(含油耗属性),火车类Train(无参构造方法),飞机类Plane(含最大航程属性及构造方法),并让它们继承Traffic类,重写行驶方法。在测试类中实例化这些子类并调用行驶方法。
摘要由CSDN通过智能技术生成

JAVA面向对象编程-试卷B

所属分类:其他

开发工具:Java

文件大小:15KB

下载次数:1

上传日期:2017-11-10 20:39:45

上 传 者:弑神唐三

说明:  定义一个交通工具类Traffic,该类包含属性:车轮的数量、行驶速度;同时还包含行驶的方法,并包含有参和无参的构造方法。请分别定义汽车类Car(包含油耗的属性,有参的构造方法)、火车类Train(无参的构造方法)、飞机类Plane(包含最大航程的属性,包含无参和有参的构造方法),让他们继承Traffic,并重写行驶的方法。在测试类中分别创建三个子类的对象,并调用行驶的方法。(

(A vehicle class Traffic is defined, which contains attributes: the number of wheels, the speed of travel, and the method of driving, including the parametric and parametric construction methods. Please define auto Car (with the construction method of ginseng contains fuel properties), Train (train class construction method of no arguments), class Plane (including aircraft attributes, the maximum range contains no parameters and construction method of ginseng), let them inherit the Traffic method, and override driving. In the test class, three objects of the subclass are created, and the driving method is called. ()

文件列表:[举报垃圾]

JAVA面向对象编程-试卷B.doc

近期下载者:

相关文件:

收藏者:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值