Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
NOTE
Putting debugging exercises in a book can be a bit strange. If the book includes the code, you can stare at it until you see the bugs without using the debugger, and that would defeat the purpose.
For that reason, this section only describes the programs containing the bugs and you'll have to download the broken programs from the book's web site at www.wrox.com or www.CSharpHelper.com/24hour.html. You can find the programs and corrected versions in the Lesson12 folder. The corrected versions are named after their exercises, for example, Ex12-1Solution. Modified lines are marked with comments.
Debug the CelsiusToFahrenheit program shown in Figure 12-7. (Hint: 0 Celsius = 32 Fahrenheit and 100 Celsius = 212 Fahrenheit.)
Debug the FeetToMiles program shown in Figure 12-8. (After you fix this one, notice that using constants instead of magic numbers and the approach taken by Exercises 5 and 6 in Lesson 11 would make fixing these bugs easier and might have avoided them from the start. Also note again that the duplicated code is a bad thing that you'll learn how to fix in Lesson 20.)
The ResizePicture program is supposed to zoom in on a picture when you adjust its TrackBar. Unfortunately when you move the TrackBar, the picture seems to shrink and move to a new location. Debug the program.
Debug the TaxForm program, which performs a fictitious tax calculation based on a real one. It's an ugly little program, but it's probably the most realistic one in this lesson. (Hint: For the program's initial inputs, the tax due should be $290.00.)