54. Test Question #2

Questions and discussion for this lecture live here. Fire away by hitting Reply below :fire:

Hello all,
I am a bit confused about the means by which I allow for member-specific EA values. My first attempt involved creating another array near the start, specifying EA values for each member. Thereafter, I believe I have to remove the EA component in the calculateKg function, and either possibly replace it with member-specific values or apply these values elsewhere. Any help would be greatly appreciated, as this will be the cherry on top for what has been an otherwise enjoyable and helpful learning experience.

Regards,
Tony

Hi Tony,
You’re exactly right - this is how you would do it. In fact I have done this in some later courses.

As you say, the most convenient approach is to specify an array of E values and and array of A values (or combined EA if you prefer) at the outset. Then, whenever these quantities are referenced throughout the code, simply index into the array(s) to extract the appropriate values for each member.

After you’ve created an altered version of the code, make sure to test it against the original (with common EA for all members), to make sure it still yields the correct result when you assign all members the same E and A values.

Seán