模拟物流快递系统程序设计

一个模拟物流快递系统的程序,能够模拟后台系统处理货物的过程 

package expressage;

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 void transport();
    //编号
    public void setNumber(String number){
        this.number=number;
    }
    public String getNumber(){
        return number;
    }
    //型号
    public void getModel(String model){
        this.model=model;
    }
    public String getModel(){
        return model;
    }
    //负责人
    public void setAdmin(String admin){
        this.admin=admin;
    }
    public String getAdmin(){
        return admin;
    }
}

 

package expressage;

public interface Careable {
    public abstract void upKeep();
}
 

package expressage;

public class 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(){
        System.out.println("货物运输车辆保养完毕!");
    }//重写车辆保养方法
}
 

package expressage;

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.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("运货人"+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()+"已归还!");
    }//送后操作
    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;
    }
}

 

package expressage;

public interface GPS {
    public String showCoordinate();

}

 

package expressage;

class phone implements GPS{
      public phone(){
          super();
      }
      public String showCoordinate(){
          String locateion="000,000";
          return locateion;
      }
}
 

package expressage;

public class task {
public static void main(String[] args){
    SendTask task01=new SendTask("jd5201314",8848);
    task01.sendBefore();
    System.out.println("*.................*");
    Ztransportation t=new Ztransportation("jd000","长安汽车","小强");
    phone p= new phone();
    task01.send(t,p);
    System.out.println("*.................*");
    task01.sendAfter(t);
    t.upKeep();
}
}
 

运行结果:

模拟物流快递系统程序设计