Question: (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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!