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