Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Using C++) Write a program that outputs the range of a projectile. The formula for computing this range is: range = sin(2.0 * angle) *

(Using C++)

Write a program that outputs the range of a projectile. The formula for computing this range is:

range = sin(2.0 * angle) * velocity2 / gravity

where:

angle = the angle of the projectiles path (in radians)

velocity = the initial velocity of the projectile (in meters-per-second)

gravity = the earths constant acceleration due to gravity of 9.8 meters-persecond-

per-second

range = the projectiles range (in meters)

The takeoff angle must be input by the user of your program in degrees (0 to 90) so you must

convert this angle to its radian equivalent. This is necessary because the trigonometric functions,

sin(x), cos(x), etc., require an angle argument (parameter) expressed in radians. The expression

for converting an angle in degrees to its equivalent in radians is:

Angle(in radians) = angle(in degrees) * p/180.0

where the universal constant, p, to 7 places of accuracy is:

p = 3.1415926

So, for example, an angle of 45o would become,

45 * 3.1415926 / 180.0 = 0.7853975 radians.

Your interactive input followed by your computed range output should look something like this:

Takeoff Angle (in degrees):

Initial Velocity (meters per second):

Projectile Range (in meters):

The C/C++ predefined library, , contains functions for the trigonometric sin operation

and the exponent operation (pow). You will need to open the header file to see how to

use these functions (i.e., what parameter(s) they require, what the type(s) of these parameters are,

and the type of the value returned).

As a minimum, test your program with the following test cases (NOTE: Your program

does NOT need to display these in the table form shown below)::

Takeoff Angle Initial Velocity Range

30 100

30 200

45 100

45 200

60 100

60 200

90 100

90 200

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions