Question
In the problems that follow. You must hand in your assignment is the report format as shown in Black Bound. The area of a triangle can be calculated using: area = squareroot x times (x - a) times (x - b) times (x - c) where a, b, and c are the side lengths of the triangle and x = 1/2(a + b + c). For this problem Create a function named triangle1 which calculates the area and perimeter of the triangle with given lengths a, b, and c. The function must: Input: a, b, and c. as three scalars Output: area and perimeter as two scalars Must have c as an optional input. Which when not provided, indices a right triangle and c is the longest length. Create a function triangle2 which calculates the three angles [degrees] of the triangle using cosine law with given lengths a, b, and c. The function must: Input a, b, c, as a vector Output: the angles. alpha, beta, gamma as a vector Must have c as an optional input, which, when not provided, indicates a right triangle and c is the longest length. Create a program named q(0) m which will first determine whether a triangle can be formed with the given lengths and then calculate the area. Perimeter and angle of the formed triangle. If no triangle can be formed, only display a warning message. In case only two lengths are given besides calculations, display the message that this is a right triangle. The program must use the triangle1 and triangle2 functions. In your report. Fill the following table using your program. If no triangle can be formed place x in the corresponding row.
Explanation / Answer
As you didn't mentioned which programming language.So , I wrote in C++
Code : FUNCTION 1
Note: include <cmath> to be written at the top inorder to use pow function