CSE 305 Programming Languages Fall, 2003 Professor Shapiro Homework 8 Maximum Points: 6 plus a possible bonus of 2 points Due 9:00 am, Tuesday, November 11, 2003 Copy this file to a text file named hw8.txt, edit into it your answers, and submit the file via the submit program by the deadline given above. 1. (3) What is printed by the following Java program? public class UnaryAsngmntHW8 { public static void main (String[] args) { int x=3, y = 0; y = x + --x; System.out.println("x = " + x + " y = " + y); } // end of main () }// UnaryAsngmntHW8 2. (3) Rewrite the following C function so that the only control structures it uses are if, while, and return. Your function must return the same value for each possible input as the version below, and should express the same algorithm. Bonus: (2 points) Use only one return statement in your version. int mystery(int x) { int r, w, z = 2; one: w = 2; two: if (w*z == x) goto three; w++; if (w <= z) goto two; if (z+z > x) goto four; z++; goto one; three: r = 0; goto five; four: r = 1; five: return r; }