Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Edit the given java code please. The MathVector.java file contains a class (MathVector). Building on the two previous activities, write a method that takes two
Edit the given java code please.
The MathVector.java file contains a class (MathVector). Building on the two previous activities, write a method that takes two integer arrays, puts them inside two MathVector objects, add them and return the result. 1- import java.util. Random; 2 import java.util.StringJoiner; 3 4- public class preLabc { 5 6 1/ Mathvector is output; testvaluesi and testvalues2 are inputs. 7- public static Mathvector myMethod (int[] testvaluesi, int[] testvalues2){ 8 9 int[] thirdvector = {}; 1e 11 // Create two objects of type "Mathvector". 12 Mathvector vectorobjecti = new Mathvector(testvalues1); 13 Mathvector // fill in here... 14 15 // Form for adding two vector objects using the add() method: 16 // 17 // Mathvector resultofAdditionobject = new Mathvector; 18 // resultofAdditionobject = firstvectorobject.add(secondvectorobject); 19 2e 21 // return the Math Vector Object back to the testing script. 22 return resultobject; 23 24 25 26 What do you need to do in this exercise? You need to create three "instances" of the MathVector object, VectorObjectOne & VectorObjectTwo & ResultVectorObject, in your method. If you do this correctly, your method will accept a pair of 10 arrays of integers, testValues One and testValuestwo, feed them into your first two objects. Then you'll apply the add() method to those two and return the result into ResultVectorObject of the form resultObject = firstObject.add(secondobject); // result = first + second // Step 1. // Step 2. = You use this method: Returns car instance that is the son of this vector and the sociedactare, each is ther) Grather the other car returector de that is the of this vector and the sociedvector puble Mattor octor other yar resulte fetector(array, for (int 1 array.Length resultaterarray tures If you look in the file MathVector.java you'll find this addition method. That's it. What to reproduce this on your own machine? Here are some important files: PreLabc.java (template file... you need to complete it. 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started