Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

1st Edition

1597496251, 978-1597496254

More Books

Students also viewed these Databases questions