Question: Write a computer program that computes the duration of a projectile's flight and its height above the ground when it reaches the target. As part
Write a computer program that computes the duration of a projectile's
flight and its height above the ground when it reaches the target. As
part of your solution, write and call a function that displays instruc
tions to the program user.
Problem Constant
G gravitational constant
Problem Inputs
float theta input angle radians of elevation
float distance input distance ft to target
float velocity input projectile velocity ftsec
Problem Outputs
float time output time see of flight
float height output height at impact
Relevant Formulas
time distancevelocity costheta
g x time
height velocity x sintheta x time g time
Try your program on these data sets.
Inputs Data Set Data Set
Angle of elevation radian radian
Velocity ftsec ft sec
Distance to target ft ft
This is what I have and I am not sure why it is not working any help would be great.
#define CRTSECURENODEPRECATE
Save default warning level push to the stack
#pragma warningpush
Disable Microsoft Visual C WARNING C Return value ignored: 'scanf'
#pragma warningdisable:
Compiler Includes
#include
#include
Constants
Gravitational constant
#define G
void displayInstructions
printfThis program computes the duration of a projectile flight and its height above the groumd when it reaches the target.
;
printfPlease provide the following information:
;
printf Angle of elevation in radians.
;
printf Distance to the target in feet.
;
printf Projectile velocity in feetsecond
;
int mainvoid
Local Variables
double theta ;
double time ;
double velocity ;
double height ;
double distance ;
call display instructions function
displayInstructions;
prompt and get angle of elevation in radians
printfEnter the angle of elevation in radians:
;
scanff θ
if theta theta
prompt and get distance to the target
printf
Enter the distance to the target in ft:
;
scanff &distance;
if distance
prompt and get velocity
printf
Enter the velocity in ftsec:
;
scanff &velocity;
if velocity
calculate time
time distance velocity costheta;
calculate height
height velocity sintheta timeG powtime;
if height
printf
Height lf feet
Time lf seconds
height, time;
else
printfYou have entered an invalid value for velocity.";
else
printfYou have entered an invalid value for distance.";
else
printfYou have entered an invalid theta value.";
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
