Question
Please edit the java code below. There is not a 13 floor at all. Please include: if(floor > 20) System.out.print(error) else if (floor 13) {
Please edit the java code below. There is not a 13 floor at all. Please include:
if(floor > 20)
System.out.print("error")
else if (floor <= 0)
System.out.print("error")
else if (floor == 13)
System,out.print("error")
__________________________
This is the code you will have to edit below
import java.util.Scanner;
/**
*THis program simulates a elevator panel that skips the 13th floor.
* @author KillaQ
*
*/
public class ElevatorSimulation {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Floor: ");
int floor = in.nextInt();
//Adjust floor if necessary
int actualFloor;
if(floor > 13)
{
actualFloor = floor - 1;
}
else
{
actualFloor = floor;
}
System.out.println("The elevator will travel to the actual floor " + actualFloor);
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started