Question: * use java * Imagine yourself as an astronaut ( represented as 3 D vector ) on a space mission to explore a distant galaxy.

*use java*Imagine yourself as an astronaut (represented as 3D vector) on a space
mission to explore a distant galaxy. As you navigate through space, you will
encounter various celestial bodies represented as 3D vectors. Your mission is
to perform vector operations to reach your destination. Let me to guide you
on how to solve the problem:
In the class Vector3D, define the components of the vector (i.e., x,y,
z ). It is necessary to encapsulate your data since a client program,
SpaceMission, will use this class later.
Implement the methods provided in the UML diagram below for the
Vector3D class. These methods cover the fundamental vector
operations.
Now you should implement the SpaceMission class from scratch based
on the provided UML diagram.
The instance variable of this class shows your position in the space.
Now, you have identified an interesting celestial body that you wish to
travel to. To assess its feasibility, follow the steps below:
i. First, measure the distance between your current position
and the location of the celestial body, which is represented
by another vector. For this, Implement
distanceTo (Vector3D) method.
ii. To facilitate travel, there are instances where you need to
refuel by certain amounts. This process involves vector
scalar multiplication. When a vector is multiplied by a
scalar, the length (magnitude) of the vector increases
proportionally to the scalar factor. To achieve this,
implement the method refuel (double) in which you must
use scalarMultiplication as defined in the Vector3D
class.
iii. Now, use the two methods mentioned above to implement
navigate (Vector3D, double, double). This function
checks the distance to the specified celestial body. If the
distance is more than or equal to the provided threshold,
you reposition yourself to where the celestial body is. If
not, you repeatedly refuel yourself by the given refuel
amount until the distance is more than or equal to the
provided threshold. At this point, you reposition yourself.
Please note that, as the JavaDoc explains, the first input
parameter represents the position of the celestial body,
the second is the threshold, and the third is the amount by
which you refuel yourself.
Please note that, as usual, the signature of the method should not change if
it is given. If it is not provided, then the signature should match what is
given in the JUnit test cases.
* use java * Imagine yourself as an astronaut (

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!