If/Else Simulation
Category: Simulation
Author: Jessica Miller
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 a, int b) {
if (a % 10 == 0) {
b *= 10;
a += 10;
}
if (a > b) {
b = a;
} else if (a == b) {
b++;
}
System.out.println(a + " " + b);
}
1) ifElseMystery(20, 8);
2) ifElseMystery(30, 30);
3) ifElseMystery(4, 3);
4) ifElseMystery(30, 4);
5) ifElseMystery(7, 7);