(2020年整理)java模拟物流快递系统程序.doc

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

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

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

2、ipse软件编译环境4、实验设计过程:(1) 将交通工具定义成一个抽象类,和一个抽象的运输方法(2) 定义保养接口,具备交通工具的保养接口(3) 定义一个专用运输车类(4) 定义一个快递任务类(5) 定义一个包含gps接口,和实现了该接口的仪器类5、 实验代码package cn.itcast.chapter04.task02;/* * 交通工具类 */public abstract class Transportation private String number; / 编号private String model; / 型号private String admin; / 运货负责人pub

3、lic Transportation() super();/可省略public Transportation(String number, String model, String admin) this.number = number;this.model = model;this.admin = admin;/ 运输方法public abstract void transport();/ 编号public void setNumber(String number) this.number = number;public String getNumber() return number;/

4、型号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;/* * 定义保养接口,具备保养功能。 */public interface Careable /保养方法public abstract void upKeep();/* * 专用运输车类 */public class

5、 ZTransportation extends Transportation implements Careable/无参构造public ZTransportation() super(); /有参构造:车辆编号、型号、负责人public ZTransportation(String number, String model, String admin) super(number, model, admin);/ 运输方法public void transport() System.out.println(运输进行中。);/ 重写车辆保养方法public void upKeep() Sys

6、tem.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 = goodsWeight;/送前准备public void sendBefore () System.o

7、ut.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(运货人+t.getAdmin() +正在驾驶编号为+t.g

8、etNumber() +的+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()+已归还!);pub

9、lic 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 showCoord

10、inate();/* * 随意定义一个物品,实现GPS接口,拥有定位功能。 */class Phone implements GPSpublic 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();6、 运行结果 3

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 中学教育 > 其它中学文档

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