I’m redoing the chapter again trying to get a better understanding of it. I’m getting a bit lost in here and I needed some clarification on one point.
In Person.h we’re creating variables of heightInMeters, and weightInKilos. Then in the setter methods we’re establishing h and w respectively.
In Person.m we’re making those functions make heightInMeters = h; and weightInKilos = w. We also define the formula for calculating BMI.
My question is, what do we need h and w for? It seems like we’re just creating a variable to make another variable equal to it and then not using h and w for the bmi calculation.
Obviously it’s a syntax convention but I must have lost it somewhere from where we learned it earlier in the book. In the last challenge, for the Word Name comparison, I created a for loop with n and w, but those were taking on varying values from each index of an array. So they were the granular elements of each array. I can’t figure out what h and w do in this program other than just act as a go between for values that don’t change.