Question: i need help coding this in java! For each method: Design the signature of the method. Write Javadoc-style comments for that method. Write the body

i need help coding this in java!
For each method:
Design the signature of the method.
Write Javadoc-style comments for that method.
Write the body for the method.
Write one or more tests that check that the method works as specified in all cases.
 i need help coding this in java! For each method: Design
the signature of the method. Write Javadoc-style comments for that method. Write
the body for the method. Write one or more tests that check

Vectors are commonly used in Math and physics. A vector (in 3D) is signified by a direction and a length (magnitude). It is commonly represented as three components: x, y and z. Some operations on vectors include: Magnitude: for a vector v |vl= Vx2 + y2 + z2 + this is denoted as Normalizing a vector: this is a vector that is obtained by dividing each component of a vector by its magnitude. Addition of two vectors: a vector sum is a vector that is obtained by adding respective components of the two vectors. Multiplying a vector by a constant: this produces a vector obtained by multiplying each component of the current vector by the provided constant. Dot product: The dot product of two vectors v=(ux,vy,uz) and w=(wx,wy,wz) is defined as a number Vw=vx*wx+uy wy+uz wz Angle between two vectors: This is defined as v.w cos(O) = |||to| Technically given two vectors, there are two angles between them. This returns the smaller of the two angles. For example, if the two vectors align with the clock hands at 3pm, this would return 90 degrees. 2.2 What to do Write a class Vector3D that represents a 3D vector. This class should contain the following: 1. A constructor that takes in x, y, z components of the vector. 2. Methods to get the values of individual components (e.g. getx,etc.). 3. AtoString() method that returns a string that describes this vector. This string should be of the form "(x,y,z)" replacing the letters with their values. Each component should be formatted to round to exactly two decimal places (look at the String.format method to see how to do this). 4. A method getMagnitude () that returns its magnitude. 5. A method normalize () that returns a normalized version of this vector.It should throw an IllegalState Exception object if this operation cannot be completed. 6. A method add that returns the result of adding this vector to another vector. It should not change the vectors that are being added. 7. A method multiply that returns the result of multiplying this vector by a constant. It should not change the vector that is being multiplied. 8. A method dot Product that returns the dot product of this vector and another vector. It should not change the two vectors. 9. A method angleBetween that returns the angle between two vectors in degrees. It should not change the two vectors. It should throw an IllegalState Exception if this operation cannot be completed

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 Databases Questions!