16 A AaBbccr AaBbccl AaBbci AaB AaBbccl Normal No Spaci Heading 1 Font Title Sub
ID: 3784332 • Letter: 1
Question
16 A AaBbccr AaBbccl AaBbci AaB AaBbccl Normal No Spaci Heading 1 Font Title Subtitle Paragraph INTRODUCTION: A projectile is launched with a velocity in m/s and at an angle alpha in degrees. See the illustration to the right. The Cartesian coordinates (x(t),y(t) of the projectile as a function of time are computed by: x(t) v cos a et y(t) v sin a* t where vis velocity in m/s, tis time in seconds, and g is the gravitational constant 9.81 m/s.. The coordinates down range distance in meters and angle theta in degrees of the projectile as a function time are computed by: y(t) r(t) tang Note: To compute theta use either the atan or the atan2. ASSIGNMENT: write a C program that will read from the keyboard the velocity in m s, the angle alpha in degrees, and the time in seconds. After entering the input values, the program will compute the Cartesian coordinates and the polar coordinates. Print theresults to the computer screen using the fomat given below. Use your PC's cursor to determine the horizontal and vertical spacing from the output fomat OUTPUT FORMAT: PROJECTILE POSITION CALCULATIONSExplanation / Answer
Code:
#include <stdio.h>
#include <math.h>
int main()
{
printf("Enter projectile velocity in m/s: ");
double v;
scanf("%f",&v);
printf("Angle of projectile in degrees: ");
double alpha;
scanf("%f",&alpha);
alpha= alpha*(3.14/180);
printf("Enter projectile time in secs: ");
double t;
scanf("%f",&t);
printf("velocity of projectile= %f ",v);
printf("Angle of projectile= %f ",alpha);
printf("time of projectile= %f ",t);
double xcart,ycart;
double rpol;
xcart= v*cos(alpha)*t;
ycart=v*sin(alpha)*t - (0.5*9.8*t*t);
rpol = sqrt(xcart*xcart + ycart*ycart);
double theta = atan(ycart/xcart);
printf("cartesian cordinates ");
printf("x(t) = %f",xcart);
printf("y(t) = %f",ycart);
printf("polar cordinates ");
printf("r = %f",rpol);
printf("theta = %f",theta);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.