Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need some guidance on writing this code in C! the math really throws me off Assignment objectives: User Defined Functions Loops Math functions Write
I need some guidance on writing this code in C! the math really throws me off
Assignment objectives: User Defined Functions Loops Math functions Write a program to calculate the trajectory of a cannon ball. The program must ask the user for the initial velocity and initial trajectory angle then ask the user what they want to calculate, Time of flight or Max. Height or maximum horizontal range. Calculate what user wants and display the result plus the time that it takes to reach maximum height for any of the user choice. Read the requirements carefully, Formulas: 2v sine Time of flight, t= g vsine Maximum height reached, H= 2g vsin20 Horizontal range, R= g Vo o Where V, is the initial Velocity, sin 0 is the component along y-axis, cos is the component along X-axis. 0 is initial angle of projectile g is gravity in meter per second square Note: cos and sin functions use radians as their unit for angles. See conversion below. degrees x radians = 180 User input: The initial velocity valid rage is 20 to 800 m/s The initial angle valid range is 5 to 80 degrees Requirement Must implement functions for each of the followings: 1. Calculating peak height. Must not print the result in the function 2. Calculating max range. Must not print the result in the function 3. Calculating travel time. Must not print the result in the function 4. Check for valid input from the user and give the user chance to reenter the data until it is within the range Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started