#include #include #include using namespace std; // global constants const double EARTH_GRAVITY = 9.8; const double MOON_GRAVITY = 1.67; const double MARS_GRAVITY = 3.71; // function phototypes void printOutput(string where, double h, double t, double d); double hitDistance(double v, double a, double t); double airTime(double v, double a, double g); double getMaxHeight(double v, double g); double degreesToRadians(double degrees); int main() { // variable declarations double v0; double a0; double height, time, distance; // get inputs cout << "Enter initial velocity: " ; cin >> v0; cout << "Enter initial hit angle: " ; cin >> a0; // convert angle from degree to radian a0 = degreesToRadians(a0); // compute & print results height = getMaxHeight(v0, EARTH_GRAVITY); time = airTime(v0, a0, EARTH_GRAVITY); distance = hitDistance(v0, a0, time); printOutput("On Earth", height, time, distance); height = getMaxHeight(v0, MARS_GRAVITY); time = airTime(v0, a0, MARS_GRAVITY); distance = hitDistance(v0, a0, time); printOutput("On Mars", height, time, distance); height = getMaxHeight(v0, MOON_GRAVITY); time = airTime(v0, a0, MOON_GRAVITY); distance = hitDistance(v0, a0, time); printOutput("On the Moon", height, time, distance); system( "PAUSE"); return 0; } // need to do function bodies below