Question: package MEH; import java.util.concurrent.TimeUnit; public class ArrayIntro { public static void main(String[] args) { int[] aArr = new int[10]; int[] bArr = instantiateArray(); initializeArray(aArr, 3);
package MEH; import java.util.concurrent.TimeUnit; public class ArrayIntro { public static void main(String[] args) { int[] aArr = new int[10]; int[] bArr = instantiateArray(); initializeArray(aArr, 3); initializeArray(bArr, 10); System.out.println("Original contents of array aArr are:"); outputArray(aArr); System.out.println("Original contents of array bArr are:"); outputArray(bArr); System.out.println(); System.out.println("Performing Deep Copy....."); //use the TimeUnit class to pause the program //This call has to be made inside a try/catch try { TimeUnit.SECONDS.sleep(3); } catch (InterruptedException e) { //do nothing } deepCopy(aArr, bArr); System.out.println("The contents of array aArr are:"); outputArray(bArr); //write statements to test each of the remaining methods } static void deepCopy(int[] copyFrom, int[] copyTo) { //code to copy array } static int[] instantiateArray() { //code to create and return a new array //the return statement below is added so the class will compile. Replace with your own code. return new int[10]; } static void initializeArray(int a[], int x) { //code to initialize each element of array to the value x //why is this void? Can it be modified to return an array? } static void outputArray(int[] a) { //code to output each element of the array } static int sumIntArray(int[]a) { //adds all elements of a together and returns an integer //the return statement below is added so the class will compile. Replace with your own code. return 0; } static double meanIntArray(int[] a) { //calculates the mean of the values stored in the array and returns a double //the return statement below is added so the class will compile. Replace with your own code. return 0.0; } static int minValue(int[] a) { //returns the smallest value stored in the array //the return statement below is added so the class will compile. Replace with your own code. return 0; } static int maxValue(int[] a) { //returns the largest value stored in the array //the return statement below is added so the class will compile. Replace with your own code. return 0; } static void outputRange(int[] a) { //outputs the range of values in the array (smallest to largest) } }
This is source code that was given. The changes that need to be made are the comments within the code. This is done in java
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
