Question: Task 4 (15 Marks) The area of a triangle (whose sides have lengths a, b and c) can be calculated using Heron's formula as shown

 Task 4 (15 Marks) The area of a triangle (whose sides

Task 4 (15 Marks) The area of a triangle (whose sides have lengths a, b and c) can be calculated using Heron's formula as shown in Eqs. (2) and (3). (5 Marks) Write a C++ function that calculates the area of a triangle using Heron's formula. a. b. (10 Marks) Use the function in a program that prompts the user for the lengths of the sides of a triangle and displays the area of the triangle. After displaying the value, the program should indefinitely go back to prompt for the lengths of sides of the next triangle then recalculate and display the area. a. b. The program should quit when the user enters a negative number. The prompt of the program should inform the user as to how to quit it (by entering a negative number for a length of the triangle's side). c. (15 Bonus Marks) Modify the program in b. so that it takes the x, y and z c user input and then computes the lengths of the triangle's sides before computing the area. c. HINT: include Area, A = As-a) (s-b)(s-c) a+b+c

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!