King_Weaver
Gawd
- Joined
- Nov 26, 2006
- Messages
- 620
Ok so for a project thats due friday I have to create a program that counts steps and floors as if you were climbing them. There are 10 steps between each floor and 5 floors and then the program must count down from floor 5 step 0 back to floor 0 step 0. so the output should look like this.
you are on floor 0 step 0
you are on floor 0 step 1
......
you are on floor 4 step 10
you are on floor 5 step 0
you are on floor 4 step 10
you are on floor 4 step 9
I really dont even know where to start. heres what ive got so far but im not sure where to go with it.
you are on floor 0 step 0
you are on floor 0 step 1
......
you are on floor 4 step 10
you are on floor 5 step 0
you are on floor 4 step 10
you are on floor 4 step 9
I really dont even know where to start. heres what ive got so far but im not sure where to go with it.
Code:
public class Project4Loops {
public static void main(String[] args) {
int floor = 0;
int step = 1;
while (floor <5 && step <11) {
System.out.println("You are on floor " + floor + " step " + step);
step++;
}
}
}