模拟物流快递系统程序设计
Posted ivan999
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了模拟物流快递系统程序设计相关的知识,希望对你有一定的参考价值。
ransoprtation.java 抽象方法类,包含交通工具信息和运输货物方法,
/* * 交通工具类 */ public abstract class Transoprtation { private String number; private String model; private String admin; public Transoprtation(){ } public Transoprtation(String number,String model,String admin){ this.model=model; this.number=number; this.admin=admin; } public abstract void transport(); public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public String getModel() { return model; } public void setModel(String model) { this.model = model; } public String getAdmin() { return admin; } public void setAdmin(String admin) { this.admin = admin; } }
Careable.java 保养接口
public interface Careable { /* * 定义保养接口,具备保养功能 */ public abstract void upKeep(); }
Ztransportation.java专用运输车类
/* * 定义专用车辆类,该类继承了交通工具接口,并实现了保养接口, */ public class Ztransportation extends Transoprtation implements Careable{ public Ztransportation(){ } public Ztransportation(String number,String model,String admin){ super(number,admin,model); //指定调用父类中的参数 } @Override//重写保养方法 public void upKeep() { // TODO Auto-generated method stub System.out.println("货物运输车辆保养完毕。。。"); } @Override//定义运输方法 public void transport() { // TODO Auto-generated method stub System.out.println("运输进行中。。。"); } }
SendTask.java快递任务类
public class SendTask { private String number; private double goodsWeigh; public SendTask(){ } public SendTask(String number,double goodsWeight){ this.number=number; this.goodsWeigh=goodsWeight; } //送前准备 public void sendBefore(){ System.out.println("订单开始处理,仓库验货中。。。"); System.out.println("货物重量"+goodsWeigh); System.out.println("货物检验完毕!"); System.out.println("货物装填完毕。"); System.out.println("运货人已通知。"); System.out.println("快递单号"+number); } //发送货物 public void send(Transoprtation t,GPS tool){ System.out.println("运货人。"+t.getAdmin()+"正在驾驶标号为"+t.getNumber() +"的"+t.getModel()+"发送货物"); t.transport(); String showCoordinate = tool.shuwCoordinate(); System.out.println("货物当前坐标为"+showCoordinate); } //送后操作 public void sendAfter(Transoprtation 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 getGoodsWeigh() { return goodsWeigh; } public void setGoodsWeigh(double goodsWeigh) { this.goodsWeigh = goodsWeigh; } }
GPS.java 接口
public interface GPS { public String shuwCoordinate(); }
Phone.java 继承GPS
public class Phone implements GPS { public Phone(){ } @Override public String shuwCoordinate() { String location = "193.264"; return location; } }
Task02Test.java 测试类
public class Task02Test { public static void main(String[] args) { SendTask task = new SendTask("hxy660235",75.31); task.sendBefore(); System.out.println("=========================="); Ztransportation t = new Ztransportation("Z025","bmw","xiaoli"); Phone p = new Phone(); task.send(t, p); System.out.println("=========================="); task.sendAfter(t); t.upKeep(); } }
以上是关于模拟物流快递系统程序设计的主要内容,如果未能解决你的问题,请参考以下文章
快递物流管理系统(SSM,JQUERY-EASYUI,MYSQL)