class Main { public static void main(String[] args) { //these variables are used to save each result of the exercise boolean res1 = false; boolean res2 = false; boolean res3 = false; boolean res4 = false; boolean res5 = false; boolean res6 = false; boolean res7 = false; boolean res8 = false; boolean res9 = false; /* note that we use scopes here - this is not yet explained in the lecture. in java you can open a new scope by a opening bracket { and close it with a matching } the usecase of scopes is that you can define variables that are only valid within a scope e.g. { int a = 3; //this variable will be known within the brackets } but will be unknown once the bracket is closed The other benefit is that you can use the same name multiple times { //scope 1 int a = 3; } { int a = 4; } The a which is assigned 3 is independent of the one that is assigned 4 We use this heavily in this exercise, such that we do not need to come up with a lot of different variable names. You will learn more about this in the lecture. */ { int b = 5; int a = b = 3; res1 = (b == ?); //you are supposed to replace the "?" with a literal (a constant number) } { int a = 13; a += 5; a /= 2; res2 = (a == ?); } { int a = 17; int b = ((3*5) % 5 + 2 % 5) % 5; res3 = (b == ?); } { int a = 33; int b = a++; b = b % 3; int c = a % (1 + b++ ); res4 = (c == ?); } { int a = 15; int b = 2; int c = a%(++b); res5 = (c == ?); } { int a = 3; if (a < 2) a = 10; a = 4; if(a < 5) a = 33; else a = 17; res6 = (a == ?); } { double x = 3.999999999; int c = (int) x; res7 = (c == ?); } { int a = 3; int b = 10; do{ a -= 1; b += a; }while (a != -1); res8 = (b == ?); } { int b = 10; for (int i = 0; i < 3; i++) b = b + i; res9 = (b == ?); } System.out.println("results"); System.out.println("result1: " + res1); System.out.println("result2: " + res2); System.out.println("result3: " + res3); System.out.println("result4: " + res4); System.out.println("result5: " + res5); System.out.println("result6: " + res6); System.out.println("result7: " + res7); System.out.println("result8: " + res8); System.out.println("result9: " + res9); } }