码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2019-03-14 21:15:45      阅读:467      评论:0      收藏:0      [点我收藏+]

标签:turn   rri   hone   style   number   generated   auto   transport   override   

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();
        
    }

}

 

 

技术图片

 

 

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

标签:turn   rri   hone   style   number   generated   auto   transport   override   

原文地址:https://www.cnblogs.com/ivan999/p/10533450.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!