Solutions to other chapters:
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); |
|