Question: I need help with my Programming class. Here are some code I wrote down but incomplete. #include #include #include const double pi = 3.14159265358979323846264338327950288419716939937510; //pi

I need help with my Programming class. Here are some code I wrote down but incomplete.

#include

#include

#include

const double pi = 3.14159265358979323846264338327950288419716939937510; //pi constant

const double g = 9.81; //gravity constant

double deg_to_rad(double d_angle) // converting degree to rad

{

return pi*d_angle / 180.0; // convert deg to rad and return rad

}

double x_velocity(double init_v, double init_deg)

{

return init_v*cos(init_deg);

}

double y_velocity(double init_v; double init_deg; double tf)

{

return (init_v*sin(init_deg))-(g*tf);

}

int main(void)

{

double tf, init_v, init_deg, height, init_x, time_increment_current_t;

int data_rows;

std::cout << "This program calculates the trajectory of a paintball. " <

std::cout << "The time will start at t=0s.What is the final time in seconds?" <

std::cin >> tf;

std::cout << "How many rows of data do you want in the table?Please enter an int." <

std::cin >> data_rows;

std::cout << "What is the initial velocity in m/s (100 m/s is typical)?" <

std::cin >> init_v;

std::cout << "What is the initial angle in degrees?" <

std::cin >> init_deg;

std::cout << "What is the height of the paintball marker barrel in m?" <

std::cin >> height;

std::cout << "What is the initial x or horizontal distance in feet (0 m typical)?" <

std::cin >> init_x;

time_increment = (tf-0) / (double)(data_rows-1);

calculation mycalc;

curent_t = 0.0;

std::cout << " for loop ";

std::cout << " Data Table " << "Angle (deg)" << "sincostan ";

std::cout << std::fixed << std::setprecision(5);

for (int i(0); i

{

std::cout << "inside the for loop, time = " << current_t << std::endl;

current_t = current_t + time_increment;

}

}

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 Programming Questions!