
My codes works great . No more errors. Thank you guys for all the suggestions.
I removed line 57 & 58. I thought that I had to do this to pass the value, but what I needed to do was just call my calc function. I agree with the revision to the calc body function. The original equation given to the class was: area = sqrt (s*(s-a)*(s-b)*(s-c)); I originally had this as one line, but changed it later. I agree that one line is better than three lines and much neater too.
I couldn’t agree more about solving the problems by hand first. I had actually done this for test data 5, 8, 12 (see below)
5 + 8+ 12 =
25.00 perimeter
25 /2.0 = 12.50
12.50 – 5 = 7.50
12.50 – 8 = 4.50
12.50 – 12 =.50
7.50 * 4.50 * .50 = 16.88
12.50 * 16.88 = 211
sqrt (211) =
14.525839 area
I changed the code to divide by 2.0 (I always forget to do double). Lastly, I created a new variable ‘perimeter’ to store the perimeter value. And result of ‘s’ is stored in ‘s’.
I continuously learn from you guys – keep up the great job you’re doing. It’s awesome that people are so willing to help each other….
Thanks again.