vehicle is flown up from the planet and will attempt to dock with the Space

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 res

πŸ’‘ Buy the answer for only $12 Get it now β†’

cue 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 <= 10 Note that distance and speed difference are checked using their absolute values and distance is the absolute difference between the position of the Space station and the position of the rescue vehicle. Speed difference is the absolute difference between the velocities (speeds) of the Space station and the rescue vehicle. So, for example, the rescue vehicle and the Space station could be within 56 units of each other, but if the speed difference was 30 units/sec, then the rescue vehicle could not dock as the speed difference is too high. The commands that can be given by the crew of the rescue vehicle to change the position and velocity of the rescue vehicle are: full ahead This sets the rescue vehicle acceleration to 4 units/sec/sec for the time slice half ahead This sets the rescue vehicle acceleration to 2 units/sec/sec for the time slice slow ahead This sets the rescue vehicle acceleration to 1 units/sec/sec for the time slice maintain This sets the rescue vehicle acceleration to 0 units/sec/sec for the time slice, this does not mean that the rescue vehicle suddenly stops. It means that the rescue vehicle maintains the same initial velocity (and thus direction) for the whole time slice. slow astern This sets the rescue vehicle acceleration to -1 units/sec/sec for the time slice OOF Assignment 2 - due: 10:00 am Tuesday, 23rd September Page 5 of 13 half astern This sets the rescue vehicle acceleration to -2 units/sec/sec for the time slice full astern This sets the rescue vehicle acceleration to -4 units/sec/sec for the time slice abandon This command closes the program after displaying a failure message to the screen. There is no limit (within the number of attempts) to how many times each command may be issued. At the start of each time slice (time through the loop) you are free to issue the same command or a different command. Any commands entered that are not in the list above should be ignored and no changes to the velocity (speed) or position should be made, this includes the speed and position of the Space station. Program Requirements You are required to write a program, in Java, to simulate docking a rescue vehicle with a Space station, in space. The program starts by (randomly) assigning a distance to the rescue vehicle which will be between 0 and 1000 units (exclusive). Recall that this figure will be negative as the rescue vehicle always starts to the right of the Space station. The initial velocity (speed) of the Space station is 7.7 units / sec and the initial position is 0. The initial velocity (speed) of the rescue vehicle is 5.53 units / sec and the initial position is set as described above. Then the program presents the user with a menu (for the rescue vehicle), as shown below: Command Menu full ahead half ahead slow ahead maintain slow astern half astern full astern abandon Enter command >> 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.

πŸ’‘ Buy the answer for only $12 Get it now β†’