Question: Java Script Create a MathVector object. Have it accept an integer array of three values. Then calculate the magnitude of this vector using the magnitude

Java Script Create a MathVector object. Have it accept an integer arrayJava Script

Create a MathVector object. Have it accept an integer array of three values. Then calculate the magnitude of this vector using the magnitude method described in MathVector.java. If you look in the file MathVector.java you'll see there is a way to calculate the magnitude of a vector: 5 6 7 8 9 Returns the euclidean distance of this vector. 1- limport java.util. Random; 2 'import java.util.stringjoiner; 3 4- public class preLabc { public static double myMethod(int[] threevaluevector){ // Create an object of type "Mathvector". Mathvector vectorobjecti = new Mathvector(threevaluevector); 10 11 // calculate the magnitude on the object by using the magnitude method. 12 // form: double theoutput = objectName Dot magnitude parenthesis parenthesis double... // fill in here. 14 15 // return the double value here. return theMagnitude; } 13 * @return the euclidean distance of this vector */ public double magnitude() { double sum = 0; for (var e : array) { sum += Math.powle, 2); } return Math.sqrt(sum); } Two tests will be performed, each will send in a 3 value vector and you need to return double floating point value of the magnitude each time. 16 17 18 19 20 } To calculate the magnitude on the object you use MathVector.java's magnitude method. It has the form double theOutput = objectName DOT magnitude parenthesis parenthesis which could look something like double the MagnitudeValue = myObject.magnitude(); What to reproduce this on your own machine? Here are some important files: * preLabC.java (fill this in) MathVector.java (the class with all the methods that the student should explore) MyTest.java (the JUnit testing file. Student can use this on their own computer if they wish)

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!