Computing Concepts with Java 2 Essentials

{short description of image}

Bug Report Page

* = corrected in the third printing

# = corrected in the fifth printing

& = corrected in the sixth printing

*Page 60
Remove the last paragraph (which erroneously claims that you need a cast to convert from int to float) as well as the last two lines of code.
*Page 107
Change public void translate(double x, double y) to public void translate(int x, int y)
#Page 116 Common Error 3.3
Change
public class BankAccount
{  . . .
   void monthlyFee() 
to
class BankAccount
{  . . .
   public void monthlyFee() 
#Page 120 BankAccountTest.java
Indent the first line
interest = account.getBalance() * INTEREST_RATE / 100;
to line up with the line below.
#Page 122
In the 4th line from the bottom, change thePurse.add to thePurse.addCoins
#Page 135 Exercise R3.9
Add a blank line after b.deposit(10000);
&Page 136 Exercise P3.4
Under
myBeemer.drive(100); // drive 100 miles
add
myBeemer.drive(50); // drive another 50 miles
#Page 151
Change import java.awt.geom.Ellipse; to import java.awt.geom.Ellipse2D;
#Page 154 Table 2
Change "DialogIput" to "DialogInput"
#Page 165
Change private color fillColor; to private Color fillColor;.
#Page 166
Change private Color backgroundColor; to private Color fillColor;.
#Page 176
Change java.awt.geom.Line2D to java.awt.geom.Line2D.Double.
#Page 177
Change the first occurrence of java.awt.geom.Point2D to java.awt.geom.Point2D.Double. Remove the second occurrence of java.awt.geom.Point2D.
#Page 185
Change "...if you modify the value of amount" to "...if you modify the value of balance"
*Page 194 Quality Tip 5.2
Change "It is legal to use the increment operator" to "It is legal to use the decrement operator".
#Page 196
Change "If richter is 5.0" to "If richter is 6.0".
*Page 217 Exercise R5.6
Change
(p && q) || ! r   ! (p && (q || !r)) 
to
(p && q) || !r     !(p && (q || !r))
That is, remove the blank space after the ! operator (2x), and add some blank space between the two expressions to make it clear that the exercise asks for the evaluation of two separate Boolean expressions.
#Page 220 Exercise P5.4
Change
Please enter three numbers:
4 9 2.5 
to
Please enter three numbers:
4
9
2.5 
That is, one number per line, and user input in green color.
*Page 221 Exercise P5.10
Change Charlie Able Baker to
Charlie
Able
Baker 
*Page 222 Exercise P5.14
Change 2.0 1.99998 to
2.0
1.99998
and 2.0 1.98999 to
2.0
1.98999
#Page 248 Productivity Hint 6.1
Change "the word-counting program of Section 6.3.2" to "the word-counting program of Section 6.5.3"
*Page 265 Exercise P6.9
In the second formula for s, change the second sum under the square root,Sxi, to (Sxi)2
Page 265 Exercise P6.10
Change "...and that draws..." to "...and then draws..."
*Page 280
Remove the semicolon at the end of
public static BankAccount chooseAccount(BankAccount candidate1,
     BankAccount  candidate2);
&Page 295 Productivity Hint 7.3
Change “generalized regular expression pattern” to “global regular expression print”
&Page 296
Change public getDescription String () to public String getDescription()
#Page 308 Exercise P7.4
Change Ellipse2D.Double c to Ellipse2D.Double e (2x)
#Page 308 Exercise P7.7
Remove "followed by a space,".
&Page 308 Exercise P7.8
Change
public static displayH(Graphics2D g2, Point2D.Double p);
to
public static void displayH(Graphics2D g2, Point2D.Double p)
(i.e. add void and remove the semicolon). Make the same change to the next 3 lines.
#Page 308 Exercise P7.8
Remove "Fit the letters in an 1 x 1 square.". Change "Draw lines and circles" to "Draw lines and ellipses".
#Page 310 Exercise P7.11
Change halfBar(Point2D.Double start) and fullBar(Point2D.Double start) to halfBar(Graphics2D g2, Point2D.Double start) and fullBar(Graphics2D g2, Point2D.Double start).
#Page 311 Exercise P7.15
After Hint: add: "Use a recursive helper method helper(s, t, offset). " Change "then return 0" to "then return offset". Change "Otherwise call the method recursively with the tail of s (that is, s without the first character)." to "Otherwise call the helper method recursively with the tail of s (that is, s without the first character), and offset + 1."
#Page 337 Exercise R8.14
Change "inspect a string stored in a BankAccount object" to "inspect the balance stored in a BankAccount object"
#Page 338 Exercise P8.1
Below the equation, put the sentence "Hint: Don't compute the powers and factorials explicitly. Instead, compute each term from the value of the preceding term."
#Page 339 Exercise P8.8
Change "the value of n" to "the value of the exponent of the current term".
#Page 351
In the 4th line from the bottom, change "overridden method" to "overriding method".
#Page 359
In the 4th line from bottom, change TimeDepositAccount to BankAccount
#Page 391 Exercise R9.13
Change "of section 9.4" to "of section 9.6".
#Page 401. Change "the WindowListener, a class with seven methods" to "the WindowListener, an interfacewith seven methods".
*Page 419 line 7
Change public EggPanel() to public EggFrame()
#Page 437, 438
Change arrayCopy to arraycopy (3x on page 437, 1x on page 438)
#Page 440
Change if (price ++ 0) // end of input to if (price == 0) // end of input
#Page 455
Change add(int i, Point2D.Double p) to add(Point2D.Double p).
&Page 455
Add a line containing a } below the line containing cornersSize++;, lining up with the { two lines above.
*Page 470 Exercise R11.2
Change "Write code for two nested loops that fill a with ten different sequences of ten random numbers between 1 and 100." to "Write code for two nested loops that fill a with ten different random numbers between 1 and 100."
#Page 474 Exercise P11.8
Change
|x1y2 + x2y3 + . . . + xn - 1y0 - y1x2 - y2x3 - yn - 1x0|
to
|x0y1 + x1y2 + . . . + xn - 1y0 - y0x1 - y1x2 - yn - 1x0|
*Page 475 Exercise P11.11
Change public static void barChart(double[] data)to public void barChart(double[] data, Graphics2D g2)
*Page 475 Exercise P11.13
Change static void pieChart(double[] data) to public void pieChart(double[] data, Graphics2D g2)
*Page 501 line 14
Change JMenuItem moveMenu to JMenu moveMenu.
*Page 560 Exercise P13.11
Change "a random-access file in which each line has the format" to "a random-access file in which each record has the format"
*Page 562 Exercise P13.19
Change "Implement the ReadProducts program" to "Implement the PlotProducts program"
*Page 608 Exercise P14.8
Change "Explain why the move method..." to "Explain why the setLocation method..."
#Page 610 Exercise R14.6
Remove "a time stamp, " from the message properties. That is, the second sentence should read "A message has a recipient, a sender, and a message text."
#Page 610 Exercise R14.8
Remove "Supply a printout of all overlapping appointments, for example:" and the following two lines.
#Page 611 Exercise R14.11
Remove the sentence "Process human input as in the preceding exercise".
#Page 647 Exercise P15.10
Change "Hint: Use a stack to keep track of which subarrays have been sorted." to "Keep merging adjacent regions whose size is a power of 2, and pay special attention to the last area whose size is less."
#Page 647 Exercise P15.11
Remove "Set the window coordinate system to a.length by 100." Change "Whenever you change the array, clear the screen and redraw." to "Whenever the algorithm changes the array, display an option pane and wait for the user to click Ok, then call the repaint method."
*Page 680
Exercise 16.11 has been duplicated. Remove one instance.
*Page 722
Change boolean add(int index, Object element) to void add(int index, Object element) and remove the line "Returns: true" in the description of that method.
*Page 761
Change "UML (Universal Modeling Language)" to "UML (Unified Modeling Language)"

Thanks to Thomas M. Andersen, Byron W. Becker, Fred Cummins, Rick Giles, Jeff Hoft, Kenneth Kellum, Mark Levack, Suzanne Menzel, Todd Neller, Kathleen O'Brien, Michael A. J. Pellettier, Gerald Pullen, Hamzeh Roumani, Abul Sheikh, Raja Sooriamurthi, Maria Stepanov, Hans-Peter Weber, Jenny Welter and a number of anonymous contributors for their bug reports and suggestions!

Please report any remaining bugs in this edition on the bug report form.