//Dr. Ramsey - posted on March 7 #include using namespace std; double compute_distance (double v, double a, double t); void output(double v, double a, double t); int main () { double acceleration=0.0, velocity=0.0, time=0.0; cout << "Input floating point velocity in ft/s: "; cin >> velocity; cout << "Input floating point acceleration in ft/(s*s): "; cin >> acceleration; cout << "Input floating point time in s: "; cin >> time; while (time < 0) //time must be >= 0 { cout << "ERROR time is negative" << endl; cout << "Input positive time in s: "; cin >> time; } output(velocity, acceleration, time); } // a function to do output void output(double v, double a, double t) { double s; s = compute_distance(v,a,t); cout << "The distance is " << s << " feet." << endl; } // a function to compute distance based on velocity acceleration and time // time should not be negative when it reaches here, but it turns out // this function does something reasonable if it is. double compute_distance (double v, double a, double t) { double s = 0.0; s = (v*t) + (0.5*a*t*t); return s; }