elevatormgr.java

来自「这是基于java实现的三层电梯模拟,正确简单」· Java 代码 · 共 1,690 行 · 第 1/5 页

JAVA
1,690
字号
                {
                    showStatus("Person can't jump onto a moving elevator!!!");
                } else
                if(elevator.occupied6)
                {
                    showStatus("There is already someone on the elevator!");
                } else
                {
                    showStatus("Person on the First Floor is boarding the Elevator");
                    firstFloor.unOccupy6();
                    elevator.occupy6();
                    //elevator.setDestination(2);
                }
            } else
            {
                showStatus("First Floor is unoccupied1!");
            }
        }else
        if(i >= clockWidth + 130 && i <= clockWidth + 140 && j >= 215 && j <= 290)
        {
            if(firstFloor.occupied7)
            {
                if(elevator.location != 1)
                {
                    showStatus("Elevator is not on the First Floor! Call it first.");
                    error.play();
                } else
                if(elevator.moving)
                {
                    showStatus("Person can't jump onto a moving elevator!!!");
                } else
                if(elevator.occupied7)
                {
                    showStatus("There is already someone on the elevator!");
                } else
                {
                    showStatus("Person on the First Floor is boarding the Elevator");
                    firstFloor.unOccupy7();
                    elevator.occupy7();
                    //elevator.setDestination(2);
                }
            } else
            {
                showStatus("First Floor is unoccupied1!");
            }
        }else
        if(i >= clockWidth + 120 && i <= clockWidth + 130 && j >= 215 && j <= 290)
        {
            if(firstFloor.occupied8)
            {
                if(elevator.location != 1)
                {
                    showStatus("Elevator is not on the First Floor! Call it first.");
                    error.play();
                } else
                if(elevator.moving)
                {
                    showStatus("Person can't jump onto a moving elevator!!!");
                } else
                if(elevator.occupied8)
                {
                    showStatus("There is already someone on the elevator!");
                } else
                {
                    showStatus("Person on the First Floor is boarding the Elevator");
                    firstFloor.unOccupy8();
                    elevator.occupy8();
                    //elevator.setDestination(2);
                }
            } else
            {
                showStatus("First Floor is unoccupied1!");
            }
        }else
        if(i >= clockWidth + 110 && i <= clockWidth + 120 && j >= 215 && j <= 290)
        {
            if(firstFloor.occupied9)
            {
                if(elevator.location != 1)
                {
                    showStatus("Elevator is not on the First Floor! Call it first.");
                    error.play();
                } else
                if(elevator.moving)
                {
                    showStatus("Person can't jump onto a moving elevator!!!");
                } else
                if(elevator.occupied9)
                {
                    showStatus("There is already someone on the elevator!");
                } else
                {
                    showStatus("Person on the First Floor is boarding the Elevator");
                    firstFloor.unOccupy9();
                    elevator.occupy9();
                    //elevator.setDestination(2);
                }
            } else
            {
                showStatus("First Floor is unoccupied1!");
            }
        }else
        if(i >= clockWidth + 100 && i <= clockWidth + 110 && j >= 215 && j <= 290)
        {
            if(firstFloor.occupied0)
            {
                if(elevator.location != 1)
                {
                    showStatus("Elevator is not on the First Floor! Call it first.");
                    error.play();
                } else
                if(elevator.moving)
                {
                    showStatus("Person can't jump onto a moving elevator!!!");
                } else
                if(elevator.occupied0)
                {
                    showStatus("There is already someone on the elevator!");
                } else
                {
                    showStatus("Person on the First Floor is boarding the Elevator");
                    firstFloor.unOccupy0();
                    elevator.occupy0();
                    //elevator.setDestination(2);
                }
            } else
            {
                showStatus("First Floor is unoccupied1!");
            }
        }else
        
        
        
        
        //使得二层的乘客进入电梯
        
        
        
        
        
        
   
        if(i >= clockWidth + 190 && i <= clockWidth + 200 && j >= 115 && j <= 190)
        {
            if(secondFloor.occupied1)
            {
                if(elevator.location != 2)
                {
                    showStatus("Elevator is not on the Second Floor! Call it first.");
                    error.play();
                } else
                if(elevator.moving)
                {
                    showStatus("Person can't jump onto a moving elevator!!!");
                } else
                if(elevator.occupied1)
                {
                    showStatus("There is already someone on the elevator!");
                } else
                {
                    showStatus("Person on the Second Floor is boarding the Elevator");
                    secondFloor.unoccupy1();
                    elevator.occupy1();
                    //elevator.setDestination(2);
                }
            } else
            {
                showStatus("Second Floor is unoccupied1!");
            }
        } else
        if(i >= clockWidth + 180 && i <= clockWidth + 190 && j >= 115 && j <= 190)
        {
            if(secondFloor.occupied2)
            {
                if(elevator.location != 2)
                {
                    showStatus("Elevator is not on the Second Floor! Call it first.");
                    error.play();
                } else
                if(elevator.moving)
                {
                    showStatus("Person can't jump onto a moving elevator!!!");
                } else
                if(elevator.occupied2)
                {
                    showStatus("There is already someone on the elevator!");
                } else
                {
                    showStatus("Person on the Second Floor is boarding the Elevator");
                    secondFloor.unOccupy2();
                    elevator.occupy2();
                    //elevator.setDestination(2);
                }
            } else
            {
                showStatus("Second Floor is unoccupied1!");
            }
        }else
        if(i >= clockWidth + 170 && i <= clockWidth + 180 && j >= 115 && j <= 190)
        {
            if(secondFloor.occupied3)
            {
                if(elevator.location != 2)
                {
                    showStatus("Elevator is not on the Second Floor! Call it first.");
                    error.play();
                } else
                if(elevator.moving)
                {
                    showStatus("Person can't jump onto a moving elevator!!!");
                } else
                if(elevator.occupied3)
                {
                    showStatus("There is already someone on the elevator!");
                } else
                {
                    showStatus("Person on the Second Floor is boarding the Elevator");
                    secondFloor.unOccupy3();
                    elevator.occupy3();
                    //elevator.setDestination(2);
                }
            } else
            {
                showStatus("Second Floor is unoccupied1!");
            }
        }else
        if(i >= clockWidth + 160 && i <= clockWidth + 170 && j >= 115 && j <= 190)
        {
            if(secondFloor.occupied4)
            {
                if(elevator.location != 2)
                {
                    showStatus("Elevator is not on the Second Floor! Call it first.");
                    error.play();
                } else
                if(elevator.moving)
                {
                    showStatus("Person can't jump onto a moving elevator!!!");
                } else
                if(elevator.occupied4)
                {
                    showStatus("There is already someone on the elevator!");
                } else
                {
                    showStatus("Person on the Second Floor is boarding the Elevator");
                    secondFloor.unOccupy4();
                    elevator.occupy4();
                    //elevator.setDestination(2);
                }
            } else
            {
                showStatus("Second Floor is unoccupied1!");
            }
        }else
        if(i >= clockWidth + 150 && i <= clockWidth + 160 && j >= 115 && j <= 190)
        {
            if(secondFloor.occupied5)
            {
                if(elevator.location != 2)
                {
                    showStatus("Elevator is not on the Second Floor! Call it first.");
                    error.play();
                } else
                if(elevator.moving)
                {
                    showStatus("Person can't jump onto a moving elevator!!!");
                } else
                if(elevator.occupied5)
                {
                    showStatus("There is already someone on the elevator!");
                } else
                {
                    showStatus("Person on the Second Floor is boarding the Elevator");
                    secondFloor.unOccupy5();
                    elevator.occupy5();
                    //elevator.setDestination(2);
                }
            } else
            {
                showStatus("Second Floor is unoccupied1!");
            }
        }else
        if(i >= clockWidth + 140 && i <= clockWidth + 150 && j >= 115 && j <= 190)
        {
            if(secondFloor.occupied6)
            {
                if(elevator.location != 2)
                {
                    showStatus("Elevator is not on the Second Floor! Call it first.");
                    error.play();
                } else
                if(elevator.moving)
                {
                    showStatus("Person can't jump onto a moving elevator!!!");
                } else
                if(elevator.occupied6)
                {
                    showStatus("There is already someone on the elevator!");
                } else
                {
                    showStatus("Person on the Second Floor is boarding the Elevator");
                    secondFloor.unOccupy6();
                    elevator.occupy6();
                    //elevator.setDestination(2);
                }
            } else
            {
                showStatus("Second Floor is unoccupied1!");
            }
        }else
        if(i >= clockWidth + 130 && i <= clockWidth + 140 && j >= 115 && j <= 190)
        {
            if(secondFloor.occupied7)
            {
                if(elevator.location != 2)
                {
                    showStatus("Elevator is not on the Second Floor! Call it first.");
                    error.play();
                } else
                if(elevator.moving)
                {
                    showStatus("Person can't jump onto a moving elevator!!!");
                } else
                if(elevator.occupied7)
                {
                    showStatus("There is already someone on the elevator!");
                } else
                {
                    showStatus("Person on the Second Floor is boarding the Elevator");
                    secondFloor.unOccupy7();
                    elevator.occupy7();
                    //elevator.setDestination(2);
                }
            } else
            {
                showStatus("Second Floor is unoccupied1!");
            }
        }else

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?