Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions