Question: Write a program to compute the area of a triangle using side-angle-side method and reports the area of that triangle (rounded to 2 decimal places).

Write a program to compute the area of a triangle using side-angle-side method and reports the area of that triangle (rounded to 2 decimal places).

Side-angle-side formula: = 1/ 2 sin(), where a and b are two sides of the triangle, and C is the included angle.

Your program must meet the following criteria to receive full marks:

Randomly generate two values between 5 and 10 (inclusive) for two sides a and b of the triangle, respectively. You must use random module for this (see https://docs.python.org/3/library/random.html?highlight=random#module-random).

Ask the user for the angle C in degrees (assume user always gives correct input for this one, i.e., a number between 0 and 180, inclusive).

Python functions require angles in radians. So first convert the degrees value C to radians. You must use Python math module for this (see https://docs.python.org/3/library/math.html).

Compute the area of the triangle and print the results as follows. You need to use Python math module here (https://docs.python.org/3/library/math.html#trigonometric-functions).

Sample output:

Enter a value for the angle (between 0 to 180): 45

The area of the triangle with a = 7, b = 6 and c = 45 degrees is 14.85

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!