Java Methods, Third AP Edition Errata ============================== Page 131, Question 27: Items 3 and 4 should be: 3. Add to the Rainbow class a declaration of a private final field skyColor of the type Color, initialized to Color.CYAN (the color of the sky). The Rainbow’s constructor sets the window’s background to skyColor. 4. Make sure Rainbow.java compiles with no errors. Page 343, Figure 12-4: car jag = should be: Car jag = Page 519, second paragraph: doubly linked list (more precisely, a circular doubly-linked list with a header node). should be: doubly linked list. Fourth Printing: ================ (Our printer accidentally pulled old files, and we didn't catch it, so the typos and errors from the first printing have re-emerged.) Page 80: public class TestBalloon should be import java.awt.Color; public class TestBalloon Page 83: radius = radius * (1 + 0.01*percentage); should be: radius = (int)Math.round(radius * (1 + 0.01*percentage)); Page 92, Question 8 (b) and Page 94, Question 11: double height should be: int height Page 94, Question 13: Write a simple console application should start with a lower case "w." Page 243, first code fragment: int rows = 12; cols = 7; should be: int rows = 12, cols = 7; Page 273: private int gcf(int n, int d) should be in bold. Page 280, middle: Another way for initializing a variable is to it to a reference should be: Another way to initialize a variable is to set it to a reference Third Printing: ================ Page 122, last two paragraphs: mpg method should be: gasMileage method Page 164, Figure 6-7: The CrapsTable's constructor should include the statements die1 = new RollingDie(); die2 = new RollingDie(); In the rollDice method it should be: int totalPoints = die1.getNumDots() + die2.getNumDots(); int result = game.processRoll(totalPoints); Page 253, bottom: public static void remove should be: public static int remove Second Printing: ================ Page 86, top: Remove all the methods from RoundBalloon.java except draw. should add: Balloon's private fields are not directly accessible in RoundBalloon, so you need to replace the references to them in the draw method with calls to "getter" methods, as explained on Page 83. It may be convenient to introduce temporary "local" variables to hold the values obtained with getters. For example: public void draw(Graphics g, boolean makeItFilled) { g.setColor(getColor()); int r = getRadius(); int x = getX(); int y = getY(); if (makeItFilled) g.fillOval(x - r, y - r, 2*r, 2*r); else g.drawOval(x - r, y - r, 2*r, 2*r); } Page 232, Question 18 (b): Do not count and empty string as a palindrome. should be: Do not count an empty string as a palindrome. Page 311, Question 7: one degree Celsius is 5/9 degree Fahrenheit should be: one degree Fahrenheit is 5/9 degree Celsius First Printing: ================ Page 80: public class TestBalloon should be import java.awt.Color; public class TestBalloon Page 83: radius = radius * (1 + 0.01*percentage); should be: radius = (int)Math.round(radius * (1 + 0.01*percentage)); Page 92, Question 8 (b): double height should be: int height Page 94, Question 13: Write a simple console application should start with a lower case "w." Page 273: private int gcf(int n, int d) should be in bold. Page 280, middle: Another way for initializing a variable is to it to a reference should be: Another way to initialize a variable is to set it to a reference Please email support@skylit.com if you find an error or a typo.