If/Else Simulation
Category: Simulation
Author: Alan Borning and Dan Grossman
Book Chapter: 4.1
Problem: If/Else Simulation
For each call below to the following method, write the output that is produced, as it would appear on the console: public static void ifElseMystery(int x, int y) { int z = 4; if (z <= x) { z = x + 1; } else { z = z + 9; } if (z <= y) { y++; } System.out.println(z + " " + y); }
1) ifElseMystery(3, 20);
2) ifElseMystery(4, 5);
3) ifElseMystery(5, 5);
4) ifElseMystery(6, 10);