Errata


Print Print Icon

Submit your own errata for this product.


The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.


Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question



Version Location Description Submitted By
Printed Page 15
3rd line

"Let's set the logo up to show an About message when the users double-click on it."

The instructions that follow actually go on to explain how to show the message when the logo is single-clicked. I suspect that the intention was a single click as it's the default event that is created on the component.

Rob 
Printed Page 39
2nd paragraph

On page 39 you say that the user should be able to choose where to install the application. But I don't think that is possible with an application published with an express edition of VS.

Please correct me if I'm wrong.

Anonymous 
Printed Page 59
3rd code fragment

private void cannot be used in front of the InitializeComponent() method.

Errors occur as follows: "...Invalid expression term 'private'..." and "...Keyword 'void' cannot be used in this context..."

private alone causes: "...Invalid expression term 'private'..." and "...; expected..."

void alone causes: "...Keyword 'void' cannot be used in this context..." and "...Expected ; or = (cannot specify constructor arguments in declaration)..."


AccessToCSharp 
Printed Page 59
4th code fragment

Re: number_of_pit_stopsLabel.Name = "number_of_pit_stopsLabel";

This seems to be renaming an object to the same name that it already has. Executing this by a button click does not cause an error...but nothing happens. Changing this to 'number_of_pit_stopsLabel.Name = "XXX";' does not rename the label to XXX after execution, nor are there any errors.


AccessToCSharp 
Printed Page 64
Third handwritten block on right.

The third block says: "71 divided by 3 is 23.666666. Since number is an integer, it can only store whole numbers, so it gets rounded to 23."

The result is not rounded from 23.666666 to 23, but is truncated. If it were rounded, the value would be 24. Rounding means to go to the nearest integer. C# integer division just throws away the remainder, which is truncation.

Barry Gruber 
Printed Page 88
First line of code

I am struggling through Lab 1, so have been re-reading and re-reading. Back to the basics, right?

The very first introductory line to code inside a class is:

public class Navigator() {

Those parentheses can't really go there, right?

Errata, I presume. I didn't see it on the list.

AccessToCSharp 
Printed Page 89
Bottom line

Hello!...three times is 18 characters, but the code returns 21. If I remove the carriage return ("\ln" ) from BlahBlahBlah it returns 18. a...one time returns 2. Seems to me there should be an additional statement subtracting the number of times from the length return. Or am I missing somthing here?

BttrLtThnNvr 
Printed Page 103
first code example

Use bool for return type, not boolean

Anonymous 
Printed Page 120
answer code

There is more than one answer to puzzle on page 120. The middle portion of the loop can read:

if (x>0) {
e2.count=e2.count+1;
}
if (x>1) {
e2.count=e2.count+e1.count;
}

This will give the same answer, and even the bonus answer would be the same with the change of Echo e2=e1.

Anonymous 
Printed Page 150
Step 1 - Start a new project and add a MenuMaker class

The code as it appears on this page will not run because the object Randomizer is never instantiated. It is only declared. RAther than showing this line alone,

public Random Randomizer;

It should read

Random Randomizer = new Random();

Or else you need to leave the declaration as is and add the instantiation line later

Javier Mariscal 
Printed Page 152
2nd Method - middle of page - First sentence

"Now let's this SpeakTo() method to the ......
should be
"Now let's add this SpeakTo() method to the ......

Jeff Babb 
Printed Page 152
1st method description

"1. Here's a method to tell an Elephant to speak" ...

...isn't really correct. This first method actually tells an elephant to LISTEN, or receive a message. Elephant whoSaidIt is the speaker but its the _listening_ elephant's method when the method is doin' its thang, and its receiving the message

If anything, "Here's a method to tell an Elephant to speak" belongs to the 2nd method. The method is even named "SpeakTo()".

Which leads me to the next error...

Jeff Babb 
Printed Page 152
The annotation in the 2nd method description

"This method in the Elephant class calls another elephant's TalkTo() method."

There is no TalkTo() method. It should be...

"This method in the Elephant class calls another elephant's TellMe() method."

This is especially frustrating because SpeakTo and TalkTo are so much alike and are what a talker does, while TellMe is listener's method.

Jeff Babb 
Printed Page 246
Step 1, 5th starred item

There is ambiguity about how the queen should calculate honey consumption. "She needs to consume as much honey as if she'd worked as many shifts as the worker with the most shifts left on his job."

Should this take into account that worker's weight as well (with a possible 35% addition)? The solution assumes that the answer is yes, but this should be stated in the exercise.

Anonymous 
Printed Page 263
class diagram

EnemyAlert and Sting() in the IStingPatrol interface do not match the names in the interface code in the text

Anonymous 
Printed Page 298-299
Exercise

While the exercise works, the game setup is flawed because once the opponent ends a Move() in an outdoors location, he becomes trapped in either the garden or the driveway. In order to be able to go back indoors, he must be able to end a turn in either the front yard or back yard, but this is impossible because neither location has a hiding place, and the opponent's location is never reset.

The easiest way to fix this is to give either the front yard or back yard a hiding place.

Anonymous 
Printed Page 316
Three lines up from the bottom of page

toCard should be topCard.

Anonymous 
Printed Page 317
Second line of first paragraph

'nasty issues that come up with you...' should be 'nasty issues that come up when you...'. Change 'with' to 'when'.

Anonymous 
Printed Page 347
Deck class

Neither my solution nor the printed solution make use of Deck methods HasBook() or ContainsValue()

Anonymous 
Printed Page 349
PullOutBooks method of the Player class

In this method, the last for loop deletes (Deal's) all the cards in the deck in reverse order. This deletes all the cards in the deck, when it should only delete the 4 being put into the book. It should include an additional IF e.g.
public List<Card.Values> PullOutBooks()
{
List<Card.Values> Books = new List<Card.Values>();
for (int i = 1; i <= 13; i++)
{
Card.Values value = (Card.Values) i;
int howMany = 0;
for( int card = 0; card < cards.Count; card++ )
{
if( cards.Peek( card ).Value == value )
{
howMany++;
}
}
if( howMany == 4 )
{
Books.Add( value );
for (int card = cards.Count - 1; card >= 0;card--)
{
if( cards.Peek( card ).Value == value )
{
cards.Deal( card );
}
}
}
}
return Books;
}

Additionally, for novices, you might want to explain why you did it in reverse order.

Anonymous 
Printed Page 352
PlayOneRound method

Agree with the already posted erratum for PullOutBooks on page 349.

However, this fix increases the probability that a player will run out of cards, not just immediately after his turn, but also during the course of the round due to giving cards to other players. As a result, checks need to be added to PlayOneRound during each turn for whether each player's card count is zero.

Anonymous 
Printed Page 371
GetRandomLocation method

This method does not generate a random point within the floor of the dungeon all the time. I have had weapons and enemies appear on the walls and in the case of weapons, this means that the player cannot get to it, to pick it up. Makes it a little difficult to fight off the enemies.

Peter ormshaw 
Printed Page 371
last item in level table

Application.Exit() does not work from the game.NewLevel() method, it results in an infinite loop. It should be called from the form method UpdateCharacters().

Anonymous 
Printed Page 374
Middle of page, next to the Player constructor code

There is "hand-written" text on page 374 which points to the "hitPoints=10;" line and says "The Player's constructor sets it's hitPoints to 10 and then calls the base class constructor."

However, page 233 has large bold text that says "The base class constructor is executed before the subclass constructor". Further, page 233 has a "Do this!" exercise to prove that this is the case.

The referenced text on page 374 is wrong.

John Sheppard 
Printed Page 376
Middle of page

Enemy abstract class has an abstract Move(Random random) method
but Enemy is derived from Mover abstract class which has a Move(Direction direction, Rectangle boundaries) method.

The two don't "line up". It seems to me that the Enemy.Move method would be better named Enemy.RandomMove, and it could call Mover.Move. Don't know - maybe it's me who has misunderstood something.

Bruce MacDonald 
Printed Page 378
public abstract class Weapon : Mover

This class extends Mover, but it does not invoke the base class constructor in it's constructor. Gives error in IDE. Additionally you define game and location in this class, when they are already defined for you in Mover, so these are superfluous, as are the "this." statements in the constructor, to set them. The only difference is, in the Mover class the location is defined as protected and in this class you have defined it as private.

I think the definitions should be removed from the Weapon class, the base constructor call should be added to the Weapon constructor and the only code in the Weapon constructor should be the setting of the pickedUp variable.

Peter Ormshaw 
Printed Page 378
DamageEnemy

The erratum for DamageEnemy given by Mr. Stellman does not work. Move(direction,target,game.Boundaries); needs to be overloaded, otherwise the Move(direction,game.Boundaries) takes the player position as the reference point for the move.

Anonymous 
Printed Page 403
Bullet point 4, 2nd star.

The text says use initialFolder property of the OpeFileDialog control, when it is actually called initialDirectory.

Peter Ormshaw 
Printed Page 404
First code sample of the Sharpen Your Pencil section

Code sample shows...

if (Directory.Exists(@"C:\SYP")) {
Directory.CreateDirectory(@"C:\SYP);
}

...but the text for what the code does says...

"Check if the C:\SYP folder exists. If it doesn't, create it."

The problem is that for the 'What the code does' answer to be correct, the code should start...

if (!Directory.Exists(...

John Sheppard 
Printed Page 423
Part 4

I have [6/09] printing and this is still not fixed: the last line in button2_Click refers to deckFromFile out of scope. The DealCards call needs to be within the using block.

Anonymous 
Printed Page 463-464
code sample

This is not really an error, just that the problem is too open-ended. The simplest solution would be just to have the routine Wombat return Dingo at the end, and then not change Dingo in any of the other statements. In order for the problem to be meaningful, it should probably give "return Croc" as the final statement of the method.

Anonymous 
Safari Books Online 486
2nd Section: Something triggers an event

The written annotation next to the Ball object, second sentence says:
It's job is to...
Should be:
Its job is to...

jr.larsen 
Safari Books Online 486
3rd Section: The ball raises an event

Annotation under the Ball object graphic says:

... fired off by by Ball.

Should be:

... fired off by Ball.

jr.larsen 
Safari Books Online 487
Section 4: Subscribrs get notification

Section 4 heading says:

Subscribrs get notification

Should be:

Subscribers get notification

jr.larsen 
Safari Books Online 487
Section 5: Umpire annotation

The umpire annotation at the bottom of the page ends with:

to further react what happens.

Should be:

to further react to what happens.

jr.larsen 
Safari Books Online 487
Section 5: Fan annotation

The fan object annotation starts with:

The Fan objects checks...

Should be:

The Fan object checks...

jr.larsen 
Safari Books Online 488
Annotation next to BallEventArgs diagram

Currently says:

... to pass information hit to the event handlers ...

Should say:

... to pass information to the event handlers ...

jr.larsen 
Printed Page 502
Step 2

In the last sentence of the text describing step two, change SuzannesIngrdientList() to SuzannesSecretIngredient(). There is no SuzannesIngrdientList() method in the exercise.

Anonymous 
Printed Page 503
Inside getSuzanne_Click & inside getAmy_Click functions


I have to question the need for the "new GetSecretIngredient(..)" in getSuzanne_Click and getAmy_Click functions.
Note that both suzanne and amy make a "new GetSecretIngredient" object, so why should it be done again?

I tested the theory by removing the extra "new GetSecretIngredient()" and simply assigned "ingredientMethod = suzanne.MySecretIngredientMethod" & "ingredientMethod = amy.MySecretIngredientMethod"
It worked just fine.

Basically, I don't see why you need to new an object that was already made using new.

If I missed something, I would appreciate you letting me know about it.
Thanks.

Larry Hutcherson 
Printed Page 510
4th question

I think the word "with" should be "without" in the question: But it looks just like an event, except without the event keyword, right?

Anonymous 
Printed Page 512
ToggleMOle Method

I see no reason why you need the timer1.Interval and timer1.Start lines at the end of this method. Both mole.Show and mole.HideAgain cause the execute the callback MoleCallBack which ends by executing the same two lines, so why set the interval and start the timer twice, almost consecutively. Cannot see any reason and it works with the said lines removed.

Peter Ormshaw 
Printed Page 513
Smacked method

This is more a suggestion than a question. I would change the IF statement in this method to "if( holeSmacked == hole && hidden == false )" otherwise you can hit the button after the text has been removed/colour reset and still score.

Peter Ormshaw 
Printed Page 610
2nd Code Snippet

The AnimateBees() method needs to be declared public instead on private; otherwise you can't run it from the second timer component.

Waleed Al-Balooshi 


"Head First C# is absolutely the best introduction to the C# language for C# beginners."
--Will Wagers, C# Online