模拟物流快递系统程序_第1页
模拟物流快递系统程序_第2页
模拟物流快递系统程序_第3页
模拟物流快递系统程序_第4页
模拟物流快递系统程序_第5页
全文预览已结束

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、贺 州 学 院实 验 报 告班级 16物联2班 学号 1610818044 姓名 黄涛 评分等级 实验名称 模拟物流快递系统程序设计 日期 2017-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

6、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 = goodsWeight;/送前准备public voi

7、d sendBefore () System.out.println("订单开始处理,仓库验货中。");System.out.println("货物重量:"+this.getGoodsWeight()+"kg");System.out.println("货物检验完毕!");System.out.println("货物填装完毕!");System.out.println("运货人已通知!");System.out.println("快递单号:"+this.g

8、etNumber();/发送货物public void send(Transportation t,GPS tool) System.out.println("运货人"+t.getAdmin() +"正在驾驶编号为"+t.getNumber() +"的"+t.getModel()+"发送货物!");t. transport();String showCoordinate = tool.showCoordinate();System.out.println("货物当前的坐标为:"+showCoor

9、dinate);/送后操作public void sendAfter(Transportation t) System.out.println("货物运输任务已完成!");System.out.println("运货人"+t.getAdmin() +"所驾驶的编号为"+t.getNumber() +"的"+t.getModel()+"已归还!");public String getNumber() return number;public void setNumber(String number

10、) this.number = number;public double getGoodsWeight() return goodsWeight;public void setGoodsWeight(double goodsWeight) this.goodsWeight = goodsWeight;/* * 定义GPS接口,具备GPS定位功能。 */public interface GPS/显示坐标的方法public String showCoordinate();/* * 随意定义一个物品,实现GPS接口,拥有定位功能。 */class Phone implements GPSpublic

11、 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"

温馨提示

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

评论

0/150

提交评论