Answered step by step
Verified Expert Solution
Question
1 Approved Answer
=========================================== PROGRAM CODE TO COPY =========================================== #include #include #include #include #include using namespace std; // PLACE YOUR CODE UP HERE! All you should need is
===========================================
PROGRAM CODE TO COPY
===========================================
#include#include #include #include #include using namespace std; // PLACE YOUR CODE UP HERE! All you should need is chooseGear! int chooseGear(double value) { if (value< ) return 1; else if (value < ) return 2; else if (value < ) return 3; else if (value < ) return 4; else if (value < ) return 5; else return 6; } // while you are allowed to change whatever you want as you design the chooseGear function // for the version of the file you submit CHANGE NOTHING BELOW THIS LINE // the tests will all fail if even a letter is out-of-place below here. // in fact, it might make sense to redownload the provided code and just copy the // chooseGear function above. double accelerate(double v, int g, int &c); // YOU CANNOT CHANGE main() IN YOUR SUMBISSION int main() { int vc = 0; int time = 70; double vel = 0; for (int i = 0; i < time; i++) { double tempVel = vel; int gear = chooseGear(tempVel); vel += accelerate(vel, gear, vc); } cout << "After " << vc << " accelerations. Final velocity: " << vel << endl; return 0; } // You are not supposed to know the formula for accelerate. // ... gl trying to find it out // YOU CANNOT CHANGE THIS FUNCTION IN YOUR SUMBISSION double accelerate(double v, int g, int &c) { static int vc = 0; c = ++vc; if (g < 1 || g > 6) { cout << "No such gear!"; exit(1); } double i = v; double n = 54 % 3; int x = 256; int y = 256; for (int i = 0; i < g; i++) { x >>= i % true | 1; y >>= !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!true; if (!(i ^ (299 & 1750))) { x += x / 2; } if (!((i - 1) * (i + 1) - 2 * (i - 1) + -4)) { x &= y; x <<= 1; } } double j = true; int s = (1 << 2) + (1 << 0); int m = 0x0F >> 1; int b = 0x21; double V = 0; for (int z = 1; z < 7; z++) { double X = 1; for (int j = 1; j < 7; j++) { if (j != z) { X *= (g - j) / (z - j); } } X *= (z == (199 ^ 0xC2) ? -b / 4.0 : z > (3 ^ 1) ? !(z ^ (132 & 68)) ? -(s |= 7 + (m >>= 1)) : -s : s); s ^= m; !s ? V += n + i * (4 + (g > 4 ? 4 - g : g - 4) - v * x / 64.0) : V *= j + (m ^ g) * (i - j * v); m >>= 1; V += X; } return V / 10; }
The Final velocity should be 7.5 or higher
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started