Description
Submit assign03.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. Modify the identifying comments and other comments as needed to solve the problem presented in these instructions.
Program: assign03.c Problem: 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. Ask the user to enter an angle within the given range. If the angle is too small or too large, write an appropriate message. Else, find and print the height of the building.
Write one C program that computes and displays the results of each part above. Modify the identifying comments and other comments as needed to solve the problem presented in these instructions.
Problem Constants: MAX_ANGLE 33.0 // degrees MIN_ANGLE 27.0 DISTANCE 120.0 // meters PI 3.14159 Problem Inputs: angle in degrees
Problem Outputs: height of building in meters
Other variables: angle in radians See tan() and atan2(). Equations: radians = theta * (pi/180) height =
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 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 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 angle with 1 decimal place. Format the building height with 2 decimal places. Label output using the printf()function in sentence form.
New commands: User input scan() if..else if..else
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.
If you do not submit individually, there will be a 5 POINTS PENALTY for not joining a group. Groups can be 2-4 students. DO NOT join a group unless you have worked with the other members. If you do, you will be removed from the group and given the grade of zero.
COMP1200c – Spring 2015 – Assign03_sol – p. 1 of 2
Sample Output: Run 1: Enter an angle between 27.0 and 33.0 degrees: 50 50.0 is too large. Run 2: Enter an angle between 27.0 and 33.0 degrees: 20 20.0 is too small. Run 3: Enter an angle between 27.0 and 33.0 degrees: 29.5 Using 29.5 degrees, the building height is 67.89 meters. Submit via Canvas: assign03.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