1. Expression Value 3 * 4 + 5 * 6 + 7 * -2 28 1.5 * 2.0 + (5.5 / 2) + 5 / 4 6.75 23 % 5 + 31 / 4 % 3 - 17 % (16 % 10) -1 "1" + 2 + 3 + "4" + 5 * 6 + "7" + (8 + 9) "123430717" 345 / 10 / 3 * 55 / 5 / 6 + 10 / (5 / 2.0) 24.0 2. tyler and tv like java java and tyler like tv tv and donnie like rugby hamburger and x like tyler tyler and java like tyler 3. Method Call Output mystery(5, 0) 5 mystery(3, 2) 1 0 1 mystery(16, 5) 3 2 1 0 1 mystery(80, 9) 8 4 2 1 2 0 2 mystery(1600, 40) 40 19 2 9 0 4 0 4. y > x z < 0 z > 0 +---------------------+---------------------+---------------------+ Point A | sometimes | never | never | +---------------------+---------------------+---------------------+ Point B | never | never | sometimes | +---------------------+---------------------+---------------------+ Point C | sometimes | never | always | +---------------------+---------------------+---------------------+ Point D | always | never | sometimes | +---------------------+---------------------+---------------------+ Point E | always | sometimes | sometimes | +---------------------+---------------------+---------------------+ 5. Five solutions are shown. public static boolean hasMidpoint(int a, int b, int c) { double mid = (a + b + c) / 3.0; if (a == mid || b == mid || c == mid) { return true; } else { return false; } } public static boolean hasMidpoint(int a, int b, int c) { double mid = (a + b + c) / 3.0; return (a == mid || b == mid || c == mid); } public static boolean hasMidpoint(int a, int b, int c) { return (a == (b + c) / 2.0 || b == (a + c) / 2.0 || c == (a + b) / 2.0); } public static boolean hasMidpoint(int a, int b, int c) { int max = Math.max(a, Math.max(b, c)); int min = Math.min(a, Math.min(b, c)); double mid = (max + min) / 2.0; return (a == mid || b == mid || c == mid); } public static boolean hasMidpoint(int a, int b, int c) { return (a - b == b - c || b - a == a - c || a - c == c - b); } 6. Two solutions are shown. public static int countEvenDigits(int n) { int count = 0; while (n != 0) { int digit = n % 10; n = n / 10; if (digit % 2 == 0) { count++; } } return count; } public static int countEvenDigits(int n) { int count = 0; while (n > 0) { if (n % 2 == 0) { count++; } n /= 10; } return count; } 7. Three solutions are shown. public static void printStripped(String s) { boolean inComment = false; for (int i = 0; i < s.length(); i++) { char next = s.charAt(i); if (next == '<') { inComment = true; } else if (inComment && next == '>') { inComment = false; } else if (!inComment) { System.out.print(next); } } System.out.println(); } public static void printStripped(String s) { int start = s.indexOf('<'); while (start != -1) { int stop = s.indexOf('>', start + 1); s = s.substring(0, start) + s.substring(stop + 1); start = s.indexOf('<'); } System.out.println(s); } public static void printStripped(String s) { System.out.println(s.replaceAll("<[^>]*>", "")); }