Please always mention book name plus author(s) or publication name, would be easier for volunteers to know which book you are referring to. Since you are new and I have this book so edited title. It's from Sybex, authors Jeanne Boyarsky and Scott Selikoff.
did you read the explanation? It has an errata <-- click here to read all erratas of the book.
I mentioned book in title but in future ill try to provide as much information as possible to help volunteers identify the correct book. I'm also following the errata, there is nothing wrong with this question. The variable "name" is defined at bottom of the code and i overlooked it. Answer in book is correct. Thank you for the swift response.