Errata for Lewis/Loftus/Cocking Java Software Solutions for AP

advertisement
Errata for Lewis/Loftus/Cocking Java Software Solutions for AP* Computer Science
A, 2nd edition
Note: the “2nd color” referred to is, for the 2nd edition, blue.
-Page 91- The last line should read, “Figure 2.11 lists some methods of the Random
class.”
-Page 92- Remove “AP*” and the brackets next to Figure 2.11.
-Page 94- There should be an AP* and arrow next to “static double random ( )”
-Page 166- Each “BookList” in the example should be “bookList”
-Page 190- In the AP*-Style Multiple Choice Question 3.2 “outcome” should be in the
code font.
-Page 216- In the 1st line of the 4th paragraph, “else” should be in the 2nd color.
-Page 250- In 4.26, “Exercise 4.24” should be “Exercise 4.25”
-Page 256- In a. the line of code that reads “String myCode;” should read “private String
myCode;” with the “private” in the 2nd color.
-Page 256- In a. the line of code that reads “Code(String code)” should read “public
Code(String code)” with the “public” in the 2nd color.
-Page 286- Add the following methods to Figure 5.5:
void add (int index, Object obj)
Inserts the element into the list at the index.
Object get (int index)
Returns the element at the index.
Object set (int index, Object obj)
Replaces the element at the index with the specified object and returns the old element.
Object remove (int index)
Removes and returns the element at the index.
-Page 309- In the 2nd code line of 5.7, delete the space between “an” and “Integer”
-Page 313- In 5.5, “expression” in the code segment should be in the italic font.
-Page 361- In the last line of the 4th paragraph, the “s” in “string” should be capitalized.
-Page 462- “class” and “super” in the NonPersishable class should be in the book’s 2nd
color.
-Page 508- In 8.3 and 8.4, the braces should align with the “p” in public.
-Pages 528, 529, 532- Figures 9.10, 9.11, and 9.13 should be labeled as “AP* (AB
only).”
-Page 543- The last sentence on the page should say “Write your own queue data
structure.”
-Page 599- In AP*-Style Free Response question 10.1 a., the level of the root node in a
tree should be 1.
-Page 630 (HashMap), Page 634 (Map), Page 639 (TreeMap)- Add the following
method to the methods of HashMap, Map, and TreeMap:
public Object remove (Object key)
Removes and returns the value to which the key maps.
-Page 632- Change LinkedList title line to “LinkedList (java.util) implements List,
Queue”
-Page 633- Add methods isEmpty, remove, and peek (from pg 636 Queue interface) to
LinkedList.
-Page 633- Add the following methods to the List interface:
public void add (int index, Object obj)
Inserts the element into the list at the index.
public Object get (int index)
Returns the element at the index.
public Object set (int index, Object obj)
Replaces the element at the index with the object and returns the old element.
public Object remove (int index)
Removes and returns the element at the index.
-Page 635- Add the following method to the Math class methods:
public static double random ()
Returns a random number between 0.0 (inclusive) and 1.0 (exclusive).
-Page 636- Next to the random class there should be an asterisk. There should be a
footnote that says, “The Random class is no longer part of the AP* subset.”
Download