quote:Originally posted by DrPurdum
I can appreciate your frustration with code that crashes when an input error is made. Authors are often put between a rock and a hard place because of the sequencing of the material. For example, it is really difficult to have any meaningful code examples in the first six or so chapters because there's not enough syntax introduced yet to do so. Likewise, until you get into error handling there's not too much you can do about preventing program crashes. Finally, my book does introduce debugging earlier than most books because it can be such a valuable learning tool.
I did mention (page 12) that Windows does write code behind your back, but only for the basic form. The narrative then tells you how to add objects (e.g., labels) to the form, give it a name, and supply a default value. Did you skip chapter 1, perhaps because you already had VS installed?
I submitted the date-time tester...perhaps the monitor of this thread can check that.
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)
Im not referring to error handling, just a mention to set the text in the text box prior to executing the application just like it is in the downloadable example would have been just fine.
I didnt skip page 12, page 12 talks about visual studio generating code behind your back. The word windows isn't on this page. The example on the image shows all the using references and the form code but that is infact already on your datetime code example. I don't have any problem adding objects to forms. I have not skipped any page of the book.
Edit: One more thing in Chapter 5, In exercise 5 you ask me to determine a persons age when they enter DOB. Your answer is missing:
if (birthday.DayOfYear > currentDate.DayOfYear)
age -= 1;
Edit2: Exercise in chapter8:
idealWeights[0, j] = (female += 3.5);
idealWeights[1, j] = (male += 4.0);
You're adding 3.5 and 4.0 from the start.
So if you are starting with 60 inches using the formula you provided:
Female = 3.5 * height (in inches) - 108
Male = 4.0 * height (in inches) - 128
The correct answer would be 112 Male / 102 Female
Your example code would generate 116 Male / 105.5 Female