Authors' official companion web site
- ) sign.
It should be:
x % y = x - (x / y) * y
- ) sign.
It should be:
for (int i = -100; i <= 100; i++) {
i where it should say <variable>.
It should be:
for (int <variable> = 1; <variable> <= n;i++) {
for (int <variable> = 1; <variable> <= n; <variable>++) {
-- ).
It should be:
for (int <variable> = n; <variable> >= 1; <variable>--) {
- ) signs.
They should be:
line 41: for (int i = 1; i <= (3 - line); i++) {
line 45: for (int i = 1; i <= 2 * (line - 1); i++) {
line 49: for (int i = 1; i <= (3 - line); i++) {
- ) sign.
It should be:
for (int i = 1; i <= (SUB_HEIGHT - line); i++) {
- ) signs.
They should be:
30, 20, 10, 0, -10, -20, . . .
-7, -3, 1, 5, 9, 13, . . .
s.replace("l", "y") returns "heyyyyo"
should read:
s.replace("l", "yy") returns "heyyyyo"
(thanks to James Kim of Bellevue College, future CTO)
randomX has a small typo.
It says "prints a lines" when it should say "prints lines".
"") is passed."
But this text does not make sense for this problem, because the method accepts an int parameter, not a string.
This text should be disregarded.
(thanks to Richie Sweeney)
stdev has the wrong formula for the standard deviation due to a printing error.
The formula should be:
Point reference variable named p is created," should read, "A Point reference variable named p1 is created."
(thanks to Timur Rikhsiev)
explore method, there is a missing right curly brace just before the line that says "return false".
The complete code sample should be:
private static boolean explore(Board b, int col) {
if (col > b.size()) {
return true;
} else {
for (int row = 1; row <= b.size(); row++) {
if (b.isSafe(row, col)) {
b.place(row, col);
if (explore(b, col + 1)) {
return true;
}
b.remove(row, col);
}
}
return false;
}
}
(Thanks to Cheng Xing)
Have you found an error in our textbook? If so, please email us at:
![]()