第五个
所属分类:Java编程
开发工具:Java
文件大小:3KB
下载次数:0
上传日期:2019-06-07 23:43:26
上 传 者:青柠洛
说明: 货车要装载一批货物,货物有三种商品组成:电视、计算机和洗衣机。卡车需要计算出整批的货物重量。
要求有一个ComputeWeight接口,该接口中有一个方法:
public double computeWeight()
有三个实现接口的类:Television、Computer和WashMachine。这三个类通过实现接口compteTotalSales给出自重。
有一个Truck类,该类用ComputeWeight接口类型的数组作为成员(Truck类面向接口),那么数组的单元就可以存放Television对象的引用、Computer对象的引用或WashMachine对象的引用。程序输出Truck对象所装载的货物的总重量。
(The truck loads a lot of goods. The goods consist of three kinds of goods: TV, computer and washing machine. Trucks need to calculate the weight of the whole lot.
Requires a ComputeWeight interface with a method:
Public double computeWeight ()
There are three classes that implement interfaces: Television, Computer and WashMachine. These three classes give weight by implementing the interface compteTotalSales.
There is a Truck class, which uses an array of ComputeWeight interface types as its members (Truck class is interface-oriented), so the unit of the array can store references to Television objects, Computer objects, or WashMachine objects. The program outputs the total weight of the goods loaded by the Truck object.)
文件列表:[举报垃圾]
第五个\CheckCarWeight.class, 1115 , 2019-05-30
第五个\CheckCarWeight.java, 2812 , 2019-05-30
第五个\Computer.class, 291 , 2019-05-30
第五个\ComputerWeight.class, 139 , 2019-05-30
第五个\Television.class, 293 , 2019-05-30
第五个\Truck.class, 582 , 2019-05-30
第五个\WashMachine.class, 294 , 2019-05-30
近期下载者:
相关文件:
收藏者: