Question: Imagine that the floor has safe spaces ( stone ) to step on and dangerous spaces ( lava ) that if you step on you
Imagine that the floor has safe spaces stone to step on and dangerous spaces lava that if you step on you could get hurt. But this floor is tricky as the safe and dangerous spaces switch stones become lava and lava becomes stone In this assignment, you will write a program that simulates a sequence of safe spaces stones Your task is to print:
all safe spaces even numbers in ascending order first. At this moment lava and stones switchstones become odd, lava become even
then all safe spaces odd numbers now in decreasing order.
Task
We provide a zip file find it in Autolab that contains FloorIsLava.java.
UPDATE and SUBMIT the corresponding file.
Programming
Write a program, FloorIsLava.java, that reads integer argument from the command line.
Expect the input to be an integer value greater than or equals
If the input is nothing is expected to be printed.
The program is expected to print all even numbers up to and including the input value if even Once all the even numbers have been printed, it prints all odd numbers in descending order starting with the input value Expected Output:
For :
For :
For :
no output FloorIsLava FloorIsLava FloorIsLava
Executing and Debugging
First navigate to FloorIsLava directoryfolder
to compile: javac FloorIsLava.java
to execute: java FloorIsLava any number
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
