From the course: Debugging in C#
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Logical code challenge: Solution
(upbeat music) - [Instructor] In this challenge we have a program that attempts to find the BMI, or body mass index, for each patient in a collection of patients where each patient has a weight and height value. Let's debug the program. The first thing we'll do is just run it and see what happens. See what we get in this output and even if it will run to completion. So here, this is really strange. We get every single height and value, every single one is the same. So we have the same height for every single person in the collection, the same weight, and the same BMI. So this does not look correct. So let's go ahead and add some breakpoints. So first we can add the breakpoint to see if our patients are being initialized correctly. So we'll run it again and see what that value for patients is, if each patient is the same. So we are getting different types of patients and then we are also getting our edge cases at the end. We can even look at this a little closer to make sure we're…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.