If/Else Simulation
Category: Simulation
Author: Benson Limketkai and Marty Stepp
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 % 2 != 0) { a = a * 2; } if (a > 10) { b++; } else if (a < 10) { a--; b--; } System.out.println(a + " " + b); }
1) ifElseMystery(12, 12);
2) ifElseMystery(7, 4);
3) ifElseMystery(5, 8);
4) ifElseMystery(3, 42);