Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

hello, in the following C-program I would like to input ANY time interval (ti) such as 0.3 between 0 to 1 second and get the

hello, in the following C-program I would like to input ANY time interval (ti) such as 0.3 between 0 to 1 second and get the proper calculated output. The problem I have is that any input I enter I get both results (0 to 1.00 & 0 to 8.00 no matter the value of time intervals. I need it to be one or the other and on top of that any number I input (ti) will give same results between 0-8, maybe a boundary needs to be set

thanks

so far, this is where I am at :

#include #include #include #include #include int main() { float v, a, r, Vxo, Vyo, g, tof, t, Vx, x, y, Vy, ti; printf("Enter a velocity: "); scanf("%f", &v); printf("Enter an angle in degrees: "); scanf("%f", &a); printf("--- Input Information ----------------"); printf(" Initial Velocity Vo = %6.2f",v ); printf(" Angle in Degree = %6.2f" ,a ); printf(" --------------------------------------"); r = a * M_PI/180; printf(" Angle in radian = %6.2f", r ); Vxo = v * cos(r); printf(" Initial Horizontal Velocity = %6.2f", Vxo); Vyo = v * sin(r); printf(" Initial Vertical Velocity = %6.2f", Vyo); g = 9.80665; tof = (2 * v * sin(r))/g; printf(" Time of Flight = %6.2f", tof); printf(" Input a given time interval (ti): "); scanf("%f", &ti); printf(" -------------------------------------------------------------------------------------- "); printf(" Time Horizontal Distance Vertical Distance Vertical Velocity "); ti = 0; while (ti < 0.99) { Vx = Vxo; x = Vx * ti; y = Vyo * ti - (.5) * g * pow(ti,2); Vy = Vyo - g * ti; printf("%6.2f %6.2f %6.2f %6.2f ", ti, x, y, Vy); ti = ti + 0.01; } ti = 0; while (ti <=4.00) { Vx = Vxo; x = Vx * ti; y = Vyo * ti - (.5) * g * pow(ti,2); Vy = Vyo - g * ti; printf("%6.2f %6.2f %6.2f %6.2f", ti, x, y, Vy); ti = ti + 0.50; printf(" "); } printf(" "); ti = 5.00; while (ti <=8.00) { Vx = Vxo; x = Vx * ti; y = Vyo * ti - (.5) * g * pow(ti,2); Vy = Vyo - g * ti; printf("%6.2f %6.2f %6.2f %6.2f ", ti, x, y, Vy); ti = ti + 0.50; } printf(" Press any key to exit the program ... "); getche(); }

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

Step: 3

blur-text-image

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

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

Were they made on a timely basis?

Answered: 1 week ago

Question

Did the decisions need to be made, or had they already been made?

Answered: 1 week ago