Decision Statements and Repetition Statements

I need help with this, please help me.
Write a program that requests the user to enter coordinates of three 2D points A, B and C of a triangle with sides a. b, c and computes and displays the triangle angles in degrees. The formulas to compute angles A, B and C are as follows:

Angle A = arccos( (a*a – b*b – c*c) / (–2 * b * c ) )

Angle B = arccos( (b*b – a*a – c*c) / (–2 * a * c ) )

Angle C = arccos( (c*c – b*b – a*a) / (–2 * a * b ) )

The formulas to compute sides a, b and c are as follows:

Side a = √(2&(X_C-X_B )^2 +(Y_C-Y_B )^(2 ) )

Side b = √(2&(X_A-X_C )^2 +(Y_A-Y_C )^(2 ) )

Side c = √(2&(X_B-X_A )^2 +(Y_B-Y_A )^(2 ) )

You should design your own functions to compute and return the triangle sides and the triangle angles.
In order to compose secure and reliable program you must insert decision/selection if statements for data validation to test the computed values as valid sides of a realistic triangle. This will help you to avoid undesired side effects as run time errors.

Task 2. (Repetition). Use a for loop to Write a program to find the largest integer n such that n3 / pow(n,3) or n*n*n/ is less than 12000. Use a do….while loop to Write a program to find the smallest integer n such that n2 / pow(n,2) or n*n/ is greater than 12000.



Last edited on
Topic archived. No new replies allowed.