java模拟物流快递系统程序
品品文档#欢立下载实 验 报 告三、实验环境:Eclipse软件编译环境四、班级16 物联2班 学号1610818044 姓名 黄涛评分等级实验名称模拟物流快递系统程序设计 日期2017-10-25、实验要求1、输入、编辑、调试和运行例 4.1 ;2、输入工具类;实验设计过程:(1)将交通工具定义成一个抽象类,和一个抽象的运输方法(2)定义保养接口,具备交通工具的保养接口(3)定义一个专用运输车类(4)定义一个快递任务类(5)定义一个包含gps接口,和实现了该接口的仪器类要求输出结果如下所示:public abstract class Transportation private String number; / / 编号 private String model; / 型号 pr如若七m String admin; / 运:.匚.壹, public I ransportationO super();,可省略五、实验代码package cn.itcast.chapter04.task02;/*交通工具类*/public abstract class Transportation 3、从键盘中输入基本信息将它们输出要求输出结果如下所示:(数值任意)V -、 -=- -口 J J =_i =一 百 I“快谛仟书类而兼Sf*ndTask tsk = new SerdTask ( 调用送就准南方法task,sendHe-Fore();Systejr,outr. printin (= "利薛立语二且对象privateStringnumber;/编号privateStringmodel;/型号private String admin;public Transportation。 super (); / 可省略/运货负责人4、输入、编辑、调试和运行例 4.4 ;二、实验目的1、学会分析“模拟物流快涕系统程序设计 ”程序任务实现的逻辑思路。2、能够独立完成“模拟物流快涕系统程庠设计 ”程序的源代码编写。编译及运行3、理解类和对象的封装,继承以及多态的概念和使用。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;/型号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();)/*专用运输车类*/Careablepublic class ZTransportation extends Transportation implements /无参构造public ZTransportation() super ();)/有参构造:车辆编号、型号、负责人public ZTransportation(String number, String model, String admin) super (number, model, admin);)/运输方法public 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 = goodsWeight; )/送前准备public void send Before () System. out .println(System. out .println(System. out .println(System. out .println(System. out .println(System. out .println(订单开始处理,仓库验货中。oo ");,货物重量:"+this ,getGoodsWeight()+ "kg");,货物检验完毕!");,货物填装完毕!");,运货人已通知!");'快递单号:"+this .getNumberQ);)/发送货物public void send(Transportation t,GPS tool) System. out .println("运货人"+t.getAdmin()2欢立下载+"正在驾驶编号为"+t.getNumber()+"的"+t.getModel()+ "发送货物!");t. transportQ;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()+ ”已归还! ”);)public 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();/*随意定义一个物品,实现GP牖口,拥有定位功能。*/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();/将交通工具与GPSX具传入送货方法task.send(t,p);System. out .println( "=");/调用送后操作方法task.sendAfter(t);t.upKeep();六、运行结果电控制台工上TaskO2Test (1) Java 程序EtJavajre?j3injavjw.exe ( 2017-TT单开始处理,仓库装贲中厂二货物童量176.货物检验完毕1货物填装完毕!运货人已通知!快递里岩,HYXS60235运货人小韩正在驾驶编号为"25的大弯发遑货物!运输进行中.O <便物当前的坐林为-1。"箜5贷物运输任劳已完成运货人小鞋后驾兔的编号为Z05的大奔已归还 货物运输东辆保养完毕1欢迎您的下载,资料仅供参考!致力为企业和个人提供合同协议,策划案计划书,学习资料等等打造全网一站式需求