package lab4; public class ArrayInstance { //member variable private double[] vector; //one parameter constructor ArrayInstance(double vector[]) { int length = vector.length; this.vector = new double[length]; for (int i = 0; i < length; i++) { /*Step 1: assign value to instance variable's correct * array position using the parameter passed. * How do I access the instance variable vector ?? */ } } //copy constructor ArrayInstance(ArrayInstance copyFrom) { int length = copyFrom.vector.length; this.vector = new double[length]; for (int i = 0; i < length; i++) { /*Step 2: assign value to instance variable's correct * array position using the parameter passed. */ } } //member function /** * Name: dotProduct * PreCondition: secondVector is not null * arrays are the same size * PostCondition: Returns the calculated dot product * @params secondVector - contains vector to perform dot product with */ public double dotProduct(ArrayInstance secondVector) { double value = 0; int length = secondVector.vector.length; for (int i = 0; i < length; i++) { value += this.vector[i] * secondVector.vector[i]; } return value; } /** * Name: getArray * PreCondition: none * PostCondition: Returns copy of the array */ public double[] getArray() { /* Step 3: Make a deep copy of the vector instance variable * First find the length of the array, allocate memory for * the new array. Then perform the actual copy of elements. * The logic is similar to the one used in the constructor. */ } }