Question: Use a two-dimensional array. Modify the methods and the method calls to accommodate a 2D array. Java just change the arrays into two-dimensional arrays. Thank
Use a two-dimensional array. Modify the methods and the method calls to accommodate a 2D array.
Java just change the arrays into two-dimensional arrays. Thank you so much package MEH; import java.util.concurrent.TimeUnit; 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 //takes a 3 second pause before continueing try { TimeUnit.SECONDS.sleep(3); } catch (InterruptedException e) { } deepCopy(aArr, bArr); System.out.println("The contents of array aArr are:"); outputArray(bArr); //write statements to test each of the remaining methods //printed each statement in aARR and bARR System.out.println("Minimum value in aARR :"+minValue(aArr)); System.out.println("Maximum value in aARR :"+maxValue(aArr)); System.out.println("Minimum value in bARR :"+minValue(bArr)); System.out.println("Maximum value in bARR :"+maxValue(bArr)); System.out.println("Mean of aARR:"+meanIntArray(aArr)); System.out.println("Mean of bARR:"+meanIntArray(bArr)); System.out.println("Sum of Array aARR:"+sumIntArray(aArr)); System.out.println("Sum of Array bARR:"+sumIntArray(bArr)); } static void deepCopy(int[] copyFrom, int[] copyTo) { //copying data from one array into another. for(int i=0;ia[i]) min=a[i]; } return min; } static int maxValue(int[] a) { //this is returning the largest integer in the array. int max=a[0]; for(int i=0;i a[j]) { int temp = a[i]; a[i] = a[j]; a[j] = temp; } } } outputArray(a); } } Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
