Solutions to other chapters:
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26  
Java Methods Home Page Skylight Publishing



Java Methods A & AB:
Object-Oriented Programming and Data Structures

Answers and Solutions to Exercises

Chapter 7

1.   public static int max(int x, int y) { if (x > y) return x; else return y; }
3.   (a && !b) || (!a && b) (a || b) && !(a && b) a != b
5. (a) x && y || !a && !b
6. (a) if ((x + 2 > a || x - 2 < b) && y >= 0)
9.   x % 100 == 0 && x % 1000 != 0
10. (a) boolean inside = (x >= left && x <= right && y >= top && y <= bottom);
12.   See JM\Ch07\Exercises\Solutions\Dates.java.

Copyright © 2006 by Skylight Publishing