Question: Revise the if statement in the ElevatorSimulation 2 program below to have a single if statement with a complex condition. * / public class ElevatorSimulation

Revise the if statement in the ElevatorSimulation2 program below to have a single if statement with a complex
condition.
*/
public class ElevatorSimulation2
{
public static void main(String[] args)
{
Scanner in = new Scanner(
System.in);
System.out.print("Floor: ");
if (in.hasNextInt())
{
// Now we know that the user entered an integer
int floor = in.nextInt();
if (/* Your code goes here */)
{
System.out.println("Error: Invalid floor number");
}
else
Revise the if statement in the ElevatorSimulation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!