Problem Description and Background;There is a Space station orbiting above the planet. This Space Station has developed a;problem, its computer...
Problem Description and Background;There is a Space station orbiting above the planet. This Space Station has developed a;problem, its computer is randomly firing the forward and rearward thrusters that are;normally used to keep the Space station in a fixed orbit.;A rescue vehicle is flown up from the planet and will attempt to dock with the Space;station. The rescue vehicle has a limited amount of fuel and so must dock with the Space;station in no more than 10 attempts.;If the rescue vehicle cannot dock with the Space station in 10 attempts then it must return;to the planet and the mission is not a success, with grave consequences for the Space;station.;The Space station is, initially, travelling around the planet at +7.7 units/sec (what the units;are is not relevant to this problem). The rescue vehicle arrives in the same plane as the;Space station, initially travelling at +5.53 units/sec. Due to problems with space debris, the;rescue vehicle only detects the Space station at a random distance between 0 and 1000;(exclusive) units.;Note: "in the same plane" means that although, in space, it is possible to move up, down;right and left, we only need to consider moving right or left, that is, in the horizontal plane.;The initial position of the Space station is considered to be position 0. Any position to the;left of this initial position is considered to be positive and any position to the right of this;initial position is considered to be negative.;For this problem, consider a time slice to be 5 seconds. That is, all calculations in this;problem, that have time in their equations, will use time = 5;The rescue vehicle always starts to the right of the Space station, so its initial distance;(position) from the Space station is always negative.;At the start of a time slice, the Space station computer fires the forward or rearward;thrusters which results in an acceleration of plus or minus 2 units/sec/sec. This;acceleration is applied for the whole time slice. Whether the forward or rearward thrusters;fire is worked out by the program. The program generates a random number between 0;and 20 (exclusive). If the random number is an even number, then the rearward thrusters;fire which is an acceleration of +2, otherwise the forward thrusters fire and the acceleration;is -2.;If the Space station acceleration is +2, after the step above, then this acceleration is;applied for the whole time slice. This does not mean that the new position is going to be to;the left (more positive). The initial velocity may be so high in the negative that this positive OOF Assignment 2 - due: 10:00 am Tuesday, 23rd September Page 3 of 13;acceleration over the time slice still results in a negative final velocity. The negative final;velocity figure will be smaller but the Space station new position will still be negative (to the;right). The Space station will have slowed down. If the initial velocity was already positive;then applying another positive acceleration will result in a final velocity, for the time slice;that is even more positive, the Space station will have increased speed. The same applies;to a negative (-2) acceleration. During the time slice the Space station will slow down if it;was going left at the start of the time slice. The new position will still be more to the left just;a smaller increase. If the initial velocity was already negative then the Space station will;have a higher negative velocity at the end of the time slice and so its new position will be;even more to the right.;Exactly the same applies to new (rescue vehicle) acceleration for the rescue vehicle during;the time slice.;So at the end of the time slice the Space station will have a new position. This is;calculated using the formula;distance = ut + ? at2;where u is the initial velocity (speed) of the Space station at the start of the time slice, a is;the acceleration (either +2 or -2) and t = 5;This distance (which may be negative) is then added to the position of the Space station at;the start of the time slice, to give the Space station a new final position at the end of the;time slice, which, in turn, becomes the initial position at the start of the next time slice.;This also results in the Space station having a new final velocity (speed) at the end of the;time slice. This is calculated using the formula;v = u + at;where v is the final velocity at the end of the time slice, u is the initial velocity(speed) at;the start of the time slice, a is the acceleration and t = 5.;The final velocity at the end of the time slice becomes the initial velocity at the start of the;next time slice.;The same calculations, using the same formulas, but different figures, apply to the rescue;vehicle during each time slice.;The acceleration of the rescue vehicle is entered by the user, and is explained below.;As with the Space station, the rescue vehicle will have a new position and a new final;velocity at the end of the time slice, these, in turn, become the initial position and the initial;velocity of the rescue vehicle at the start of the next time slice.;In space things are a little bit more complicated. There is nothing to slow down a body that;is moving in space. Once a body starts moving with a certain velocity, and in a certain;direction, then that body keeps moving in that direction, with that velocity, until something;acts on the body to effect a change. OOF Assignment 2 - due: 10:00 am Tuesday, 23rd September Page 4 of 13;This means that even though a negative acceleration is applied to either the Space station;or the rescue vehicle, which would normally result in them going to the right, they may;keep moving to the left (the position increases, not decreases). The reason for this is that;the negative acceleration was not enough to change the positive velocity to a negative;velocity, as explained above.;Some careful planning needs to be done in order to get the rescue vehicle moving at;roughly the same velocity as the Space station.;In order to dock successfully ALL three of the following conditions must be true;distance is <= 100 units;speed difference is <= 25.4;number of attempts >;The user then enters a command and the program calculations are carried out, updating;both the final velocity (speed) and position of the Space station and the rescue vehicle. OOF Assignment 2 - due: 10:00 am Tuesday, 23rd September Page 6 of 13;The updated velocity and position of both the Space station and the rescue vehicle are;displayed to the screen.;The program next calculates if the rescue vehicle has successfully docked with the Space;station. If docking was successful, then a message of congratulations is displayed to the;screen and the program ends.;If docking was not successful and the maximum number of attempts has been reached;then a message is displayed to the screen instructing the rescue vehicle that it needs to;return to the planet (and that they should try a bit harder next time) and the program ends.;If docking was not successful and there are more attempts available, then the Command;menu is displayed to the user again.;Commands must be case insensitive. That means that the commands FuLL AHEad and;full ahead must have the same result.;position is always an integer value, velocity (speed) is always a real number
Paper#65834 | Written in 18-Jul-2015Price : $22