Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package winda;
- import static java.lang.Math.floor;
- import java.util.Scanner;
- public class Elevator {
- int floor = 0; // pietro
- //int choice1; // wybor windy
- int person = 0; // wybor osoby
- public Elevator() {
- } //--- konstruktor po to by utworzyc obiekt windy, tak może być pusty
- Doors d = new Doors(); //--- tworze sobie drzwi w windzie :)
- public int getFloor() { //----- zwraca pietro na ktorym jestes teraz, nie mozesz miec wszedzie soutów bo potem bedzie apka bez opcji soutów
- return floor;
- }
- //-------------------------------------
- // floor = (int)(Math.random() * 10 + 1);
- // System.out.println("Doors open? " + choice1);
- // System.out.println("Which floor are you at now (0-10) where 0 = basement: ");
- //choice1 = Keyboard.readInt();
- //--------------------------------------
- // przywolanie windy inaczej nizej
- public void move(int choice1) {
- if (choice1 > floor) {
- d.Close();
- System.out.println("The elevator is on it's way up...");
- for (person = choice1; choice1 > floor; floor++) {
- System.out.println(floor);
- }
- System.out.println("The elevator has arrived on floor " + choice1);
- d.Open();
- System.out.println("Koniec polecenia \n");
- } else if (choice1 < floor) {
- d.Close();
- System.out.println("The elevator is on it's way down...");
- for (person = choice1; choice1 < floor; floor--) {
- System.out.println(floor);
- }
- System.out.println("The elevator has arrived on floor " + choice1);
- d.Open();
- System.out.println("Koniec polecenia \n");
- } else if (choice1 == floor) {
- System.out.println("Elevator is on this floor already");
- }
- }
- public void buttonOutside(int choice1) {
- if (floor == choice1) {
- System.out.println("Enter the elevator");
- } else if (floor > choice1) {
- move(choice1);
- } else if (floor < choice1) {
- move(choice1);
- }
- }
- public void buttonInside() {
- Scanner keyboard = new Scanner(System.in);
- System.out.println("Where would you like to go? : ");
- int choice1 = keyboard.nextInt();
- move(choice1);
- }
- }
- /////-------------------------------------------
- //-----------!!!!!!!!!!!----------------------- zmienilem te dwa w 1 funkcje o nazwie move jest ona nizej
- // public void ElevatorUp(int choice1) { //czlowiek w windzie wybiera gdzie chce jechac
- // System.out.println("The elevator is on it's way up...");
- // for (person = choice1; choice1 > floor; floor++) {
- // System.out.println(floor);
- // }
- // System.out.println("The elevator has arrived on floor "+choice1);
- // d.Open();
- // }
- //
- // public void ElevatorDown(int choice1) { // czlowiek w windzie wybiera ze chce jechac w dol
- // System.out.println("The elevator is on it's way down...");
- // for (person = choice1; choice1 < floor; floor--) {
- // System.out.println(floor);
- // }
- // System.out.println("The elevator has arrived on floor "+choice1);
- // d.Open();
- // }---------!!!!!!!----------- zmienilem te dwa w 1 funkcje o nazwie move jest ona nizej
- // System.out.println ( ---------------------------- same shit as Enter Elevator
- // "To which floor would you want to go (0-10) where 0 = basement");
- // choice1 = Keyboard.readInt();
- //
- // if(floor > choice1)
- // {ElevatorDown();}
- //
- // else if(floor<choice1)
- // {ElevatorUp();}
- //}
- //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement