SOLVING TRIANGLES Objective and Significance of the Application Our main objective for our machine project is to create a C application that will compute for the missing side and angles of a triangle given the inputs ( two sides and one angle that is opposite to one of the sides) using the knowledge of triangles and the Law of Sine. Aside from solving the missing part of the triangle, it also identifies what type of a triangle it will be according to angles and the sides. It also gives the area and the perimeter. Convert the angles to radians or degrees. And checks how many triangles are there and more. The C application is especially designed or made to the Trigonometry students (like us) and the teachers too. It will help them in solving this kind of problems. Instead of memorizing the different formulas of sine and cosine just to get the missing side or angle, instead of plugging it in the calculator. An easier and an accurate way of solving these kinds of problem is our C application, just plug in the given input and the program gives the answer to the problem. Function Specifications: 1. A triangle has 3 sides and 3 angles. Let s name the sides a, b, c and the angles A, B, and C where A is the opposite of side a, B is the opposite of side B, and C is the opposite of side c. Write a program that prompts the user to input the side a, side b and angle A and tells the user to choose a function that he or she wishes to perform on that number. Below is a sample run: Input side a: Input side b: Input angle A (in degrees): Choose a function to perform on that number: a. solve for side c? b. solve for angle B? c. solve for angle C? d. get the semi-perimeter?
e. get the Perimeter? f. get Area? g. convert to radian? h. acute, right or obtuse triangle? i. equilateral, isoscelence or scalene triangle? j. draw the triangle? k. heron s or rational triangle? l. how many triangles it consist? 2. Construct a function that will calculate the side of the triangle using the law of sine. Note that Law of Sine states states: a/sina = b/sinb = c/sincc. Call this function in your main program. Below is a sample run: Input side a: 6.4 Input side b: 4.7 Input angle A (in degrees): 42 Choose a function to perform on that number: a. solve for side c? Function: a side c = 9.0 3. Construct a function that will calculate the first angle of the triangle using the law of Sines. Call this function in your main program. Below is a sample run (with the same inputs) Function: b Angle B = 29 degrees
4. Construct a function that will calculate the last angle of the triangle. Note that the sum of the angles of a triangle is always 180 degrees. Call this function in your main program. Function: c Angle C = 109 degrees 5. Construct a function that will get the semi-perimeter of the triangle. A semi-perimeter is half the perimeter of a triangle. Call this function in your main program. Below is a sample run: Function: d Semi-perimeter = 10.05 6. Construct a function that will get the perimeter of the triangle. Call this function in your main program. Function: e Perimeter = 20.1 7. Construct a function that will determine the area of the triangle. Note that the heigth and base is not given so we cannot use the basic formula for the area of the triangle whic is ½ base * height. But we can use Heron s Formula (below, where s is the semi-perimeter) Function: f Area = 4.52 sq. units 8. Construct a function that will convert degree to radian of all the angles in the triangle. Note that 180 degrees is equal to π radians. Call this function in your main program. Below is a sample run:
Function: g Angle A = 0.7330 Angle B = 0.5061 Angle C = 1.9024 9. There are three types of triangles according to the measure of angles. Acute triangle: All angles are less than 90 degrees. Right triangle: Has one right angle (90 degrees). Obtuse triangle: Has an angle more than 90 degrees. Construct a function that will check whether the triangle is acute, right or obtuse. Call this function in your main program. Below is a sample run: Function: h Obtuse Triangle 10. There are three types of triangles according to how many sides (or angles) are equal. Equilateral triangle has 3 equal sides and angles (which is always 60 degrees). Isosceles triangle has 2 equal sides and angles. Scalene triangle has no equal sides and angles. Construct a function that will check whether the triangle is equilateral, isosceles or scalene. Call this function in your main program. Below is a sample run: Function: i Scalene Triangle 11. Construct a function that will draw the triangle for the user to visualize it. Call this function in your main program.
Function: j * * * * * * * * * * * * * * * 12. Construct a function that will check if the triangle is a heron s triangle or a rational triangle or none of the two. Heron s triangle is a triangle where in the area and the perimeter is equal.rational triangle is a triangle that has positive rational sides and a rational area. (Rational numbers means that the set of all numbers can be expressed as a quotient of two integers.) Call this function in your main program. Below is a sample run: Function: k Not a heronian and a rational triangle 13. Construct a function that will check how many triangles it consists. There can be no, one or two triangle. Take Note: If Angle A is acute and side b is greater than side c (a > b) then there is one triangle. If Angle A is acute and side b is less than side c (a < b) then o If a > bsina then there is two triangles. o If a = bsina then there is one triangle. o If a < bsina then there is no triangle. If Angle A is acute and side b is equal to side c (a = b) then there is one triangle. If Angle A is obtuse then o If a > b then there is one triangle. o If a = b then there is no triangle. o If a < b then there is no triangle
Function: l There is one triangle Time Table: WEEK 1 Construct the main program and functions 1 and 2. WEEK 2 Construct functions 3 and 4. WEEK 3 Construct functions 5 and 6. WEEK 4 Construct functions 7 and 8. WEEK 5 Construct functions 9. WEEK 6 Construct functions 10 and 11. WEEK 7 Construct functions 12 and 13. WEEK 8 Finalize project.