I have 2 int variables which the user needs to enter, and I need to find the absolute value of their difference, is there a way to do it on the same principle I have started in this code?
Scanner scn = new Scanner(System.in);
int yourfloor, elefloor, desfloor;`enter code here`
System.out.println("Please enter your current floor");
yourfloor = scn.nextInt();
System.out.println("Please enter the elevator current floor(before inviting)");
elefloor = scn.nextInt();
System.out.println("Please enter your destination floor");
desfloor = scn.nextInt();
int getTime = yourfloor - elefloor;
if (getTime<0);
{getTime*(-1)};