COMP1200-C – Assign 02 solution

$24.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (1 vote)

Submit assign02.c via Canvas
Before you start writing your program: Read these instructions including the development plan. A development plan is a process that guides you through solving a problem and creating an algorithm. The algorithm has been added as comments to a guide you when writing the C program file solution for the following problem. Copy the identifying comments and code found at the end of these instructions paste into an empty editor window to start your work.
Program: assign02.c Problem: a) Trigonometry can be used to find the height of a building. Suppose you measure the angle between the line of sight and the horizontal line connecting the measuring point and the building. You can calculate the height of the building with the following formulas: tan(theta)=h/d h=d*tan(theta) Assume that the distance to the building along the ground is 120 meters and the angle measured along the line of sight is 30 degrees plus/minus 3 degrees. Find the maximum and minimum heights of the building. b) If the building is 200 meters tall and you are 20 meters away, at what angle from the ground will you have to tilt your head to see the top of the building? (Assume that your head is even with the ground.) c) Given the information in (b), how far is the distance (or hypotenuse) from your head to the top of the building?
Write one C program that computes and displays the results of each part above. Type the identifying comments and copy algorithm found at the end of these instructions and paste into an empty editor window to start your work.
Problem Constants: MAX_ANGLE 33 // degrees MIN_ANGLE 27 DIST_A 120 // meters DIST_B 20 HEIGHT_B 200 PI 3.14159 Problem Inputs:
Problem Outputs: a) Minimum and maximum height in meters b) Tilt of head angle in degrees c) Distance from head to top of building in meters
Other variables: angle in radians See tan() and atan2(). Equations: radians = theta * (pi/180) height = angle = distance =
Instructions:  See Standards for Documentation of C Programs on the Resources page on Canvas.  Insert comments at the top and throughout each file. o Include the follow comments at the beginning of this (and ALL) files. // submitter’s name, GROUP # Grade of ZERO for files with submitter name not part of Canvas group // other group members’ names For your own protection, type “none” if submitting alone. // assignment number Zero points for comments if no collaboration statement // date you completed the assignment // statement(s) about collaboration // a short narrative about what the file does
New commands: math.h #define tan(), atan2, sqrt() printf()
Read all instructions before beginning your work.
NOTE: Your submitted file(s) MUST be spelled and cased as instructed. [-5 points for not doing so.]
-5 points for absence of any of these required comments at the top at the top of each file. COMP1200c – Spring 2015 – Assign02_sol – p. 1 of 2
o Use the algorithm given as comments throughout your program.  Use descriptive variable names.  Use Sample Input/Output as a guide.  Use Generate CSD to ensure correct indenting.
 Represent ALL given values as constants.  Format the output with 2 decimal places.  Label output using the printf()function in sentence form. Sample Output: The minimum height is 61.14 meters. The maximum height is 77.93 meters. The angle that you will tilt your head to see the top of the building is 84.28 degrees. The distance from your head to the top of the building is 201.00 meters. Submit via Canvas: assign02.c C program file
Your .m script file should begin by typing the following statements into your empty editor window. • Write your/your group information on the // lines. • Copy and paste the other lines as a guide when writing the C instructions to do the tasks to solve the given problems. // submitter’s name, GROUP # // other group members’ names // assignment number // date you completed the assignment // statement(s) about collaboration // a short narrative about what the file does #include