java模拟物流快递系统程序(1)

上传人:摩西的****12 文档编号:132076484 上传时间:2020-05-12 格式:PDF 页数:3 大小:276.52KB
返回 下载 相关 举报
java模拟物流快递系统程序(1)_第1页
第1页 / 共3页
java模拟物流快递系统程序(1)_第2页
第2页 / 共3页
java模拟物流快递系统程序(1)_第3页
第3页 / 共3页
亲,该文档总共3页,全部预览完了,如果喜欢就下载吧!
资源描述

《java模拟物流快递系统程序(1)》由会员分享,可在线阅读,更多相关《java模拟物流快递系统程序(1)(3页珍藏版)》请在金锄头文库上搜索。

1、学 海 无 涯 贺 州 学 院 实实 验验 报报 告告 班级 16 物联 2 班 学号 1610818044 姓名 黄涛 评分等级 实验名称 模拟物流快递系统程序设计 日期 2017 10 25 一 一 实验要求实验要求 1 输入 编辑 调试和运行例 4 1 2 输入工具类 要求输出结果如下所示 3 从键盘中输入基本信息将它们输出 要求输出结果如下所示 数值任意 4 输入 编辑 调试和运行例 4 4 二 实验目的二 实验目的 1 学会分析 模拟物流快递系统程序设计 程序任务实现的逻辑思路 2 能够独立完成 模拟物流快递系统程序设计 程序的源代码编写 编译及运行 3 理解类和对象的封装 继承以及

2、多态的概念和使用 三 三 实验环境 实验环境 EclipseEclipse 软件编译环境软件编译环境 四 四 实验设计过程 实验设计过程 1 1 将交通工具定义成一个抽象类 和一个抽象的运输方法将交通工具定义成一个抽象类 和一个抽象的运输方法 2 2 定义保养接口 具备交通工具的保养接口定义保养接口 具备交通工具的保养接口 3 3 定义一个专用运输车类定义一个专用运输车类 4 4 定义一个快递任务类定义一个快递任务类 5 5 定义一个包含定义一个包含 gpsgps 接口 和实现了该接口的仪器类接口 和实现了该接口的仪器类 五 五 实验代码实验代码 package cn itcast chapt

3、er04 task02 交通工具类 public abstract class Transportation private String number 编号 private String model 型号 private String admin 运货负责人 public Transportation super 可省略 public Transportation String number String model String admin this number number this model model this admin admin 运输方法 public abstract v

4、oid transport 编号 public void setNumber String number this number number public String getNumber return number 学 海 无 涯 型号 public void setModel String model this model model public String getModel return model 负责人 public void setAdmin String admin this admin admin public String getAdmin return admin 定

5、义保养接口 具备保养功能 public interface Careable 保养方法 public abstract void upKeep 专用运输车类 public class ZTransportation extends Transportation implements Careable 无参构造 public ZTransportation super 有参构造 车辆编号 型号 负责人 public ZTransportation String number String model String admin super number model admin 运输方法 publi

6、c void transport System out println 运输进行中 重写车辆保养方法 public void upKeep System out println 货物运输车辆保养完毕 快递任务类 public class SendTask private String number 快递单号 private double goodsWeight 货物重量 public SendTask super 可省略 public SendTask String number double goodsWeight this number number this goodsWeight go

7、odsWeight 送前准备 public void sendBefore System out println 订单开始处理 仓库验货中 System out println 货物重量 this getGoodsWeight kg System out println 货物检验完毕 System out println 货物填装完毕 System out println 运货人已通知 System out println 快递单号 this getNumber 发送货物 public void send Transportation t GPS tool System out println

8、 运货人 t getAdmin 正在驾驶编号为 t getNumber 的 t getModel 发送货物 t transport String showCoordinate tool showCoordinate System out println 货物当前的坐标为 showCoordinate 送后操作 public void sendAfter Transportation t System out println 货物运输任务已完成 System out println 运货人 t getAdmin 所驾驶的编号为 t getNumber 的 t getModel 已归还 publi

9、c String getNumber 学 海 无 涯 return number public void setNumber String number this number number public double getGoodsWeight return goodsWeight public void setGoodsWeight double goodsWeight this goodsWeight goodsWeight 定义 GPS 接口 具备 GPS 定位功能 public interface GPS 显示坐标的方法 public String showCoordinate 随

10、意定义一个物品 实现 GPS 接口 拥有定位功能 class Phone implements GPS public Phone 空参构造 super 定位方法 public String showCoordinate String location 193 485 return location 定义测试类 public class Task02Test public static void main String args 快递任务类对象 SendTask task new SendTask HYX600235 76 34 调用送前准备方法 task sendBefore System out println 创建交通工具对象 ZTransportation t new ZTransportation Z025 大奔 小韩 创建 GPS 工具对象 Phone p new Phone 将交通工具与 GPS 工具传入送货方法 task send t p System out println 调用送后操作方法 task sendAfter t t upKeep 六 六 运行结果运行结果

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 中学教育 > 试题/考题 > 初中试题/考题

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号