For each of the following, correct the syntax errors.
1. if (x > 25.0) y = x; else y = z; 2. if (x > 0) System.out.println("positive " + x); else System.out.println("negative " + x);
What is the output of each of the following statements? Assume that each problem uses the values x = 5, y = 2, z = 10, and temp = 0
3. 5 2 10 4. (nothing is printed) 5. 7 6. -8 2 10 7. if (angle == 90) System.out.println("right angle\n"); else System.out.println("not a right angle\n"); 8. if (temp1 - temp2 > 2.3) approx = (temp1 - temp2) * factor; 9. if (credits >= 122) System.out.println("You are ready to graduate\n"); else System.out.println("You are not ready to graduate\n");
Email Me |
Office Hours |
My Home Page |
Department Home |
MCC Home Page
© Copyright Emmi Schatz 2013