import java.util.Scanner;
public class Elevator {
static int currentFloor = 1;
public static void main(String[] args) {
System.out.println("Welcome to my Java elevator");
while(currentFloor >=1 && currentFloor <= 3) {
Scanner input = new Scanner(System.in);
System.out.print("Would you like to go 'up' or 'down': ");
String direction = input.nextLine().trim().toLowerCase();
input.close();
if (direction == "up") {
goUp();
displayCurrentFloor();
}
if (direction == "down") {
goDown();
displayCurrentFloor();
} else {
System.out.print("Error.. instructions unclear.");
}
}
}
public static void displayCurrentFloor() {
System.out.println("moving.. current floor: "+ currentFloor);
}
public static void goUp() {
++currentFloor;
}
public static void goDown() {
--currentFloor;
}
}
// All of my entries be it "up" or "down" or anything else, returns with my currentFloor decreasing by 1. Need help fixing this.