设计一个单布电梯运行控制系统
package lanrendianti;
public class Elevator {
private String mode; //电梯模式属性 ,ER,FR
private String direction; //电梯状态属性,up,DOWN,STILL
private Double sendtime; //用户发起请求时间
private Double endtime=0.0; //代你提结束云兄时间
private int nowfloor=1; //电梯当前所在的楼层,初始化为1
private int aimfloor; //电梯所要到的目标楼层
public void setmode(String mode) { //设置模式
this.mode = mode;
}
public void setdirection(String direction) { //设置状态
this.direction = direction;
}
public void setsendtime(double sendtime) { //设置发起请求时间
this.sendtime = sendtime;
}
public void setendtime(double endtime) { //设置电梯结束运行时间
this.endtime = endtime;
}
public void setnowfloor(int nowfloor) { //设置电题当前所在楼层
this.nowfloor = nowfloor;
}
public void setaimfloor(int aimfloor) { //设置电题所要到达的目标楼层
this.aimfloor = aimfloor;
}
//相面六个方法分别为得到电题相应的6个属性值的方法
public String getmode() {
return this.mode;
}
public String getdirection() {
return this.direction;
}
public Double getsendtime() {
return this.sendtime;
}
public Double getendtime() {
return this.endtime;
}
public int getnowfloor() {
return this.nowfloor;
}
public int getaimfloor() {
return this.aimfloor;
}
}
import java.util.LinkedList;
public class Main {
public static void main(String[] args) { //程序入口
Input input = new Input();
LinkedList<String> list = input.getList(); //new一个Input对象,在getlist()方法中输入命令command,放到list中
RequestsQueue requestsqueue = new RequestsQueue(); //new一个存储着用户名令的电梯请求队列对象
while(true) {
if(list.isEmpty()==true) list = input.getList(); //得到一个用户输入的有效命令
String[] command = input.inputchange(list.poll()); //从list中取出一个命令,并在inputchange()方法中把它简化一下
Elevator elevator = new Elevator(); //new一个电梯对象