Write a class that has the following methods. Use nested for loops for all of th
ID: 3783813 • Letter: W
Question
Write a class that has the following methods. Use nested for loops for all of these array operations: public static void initialize (int[] [] a, int nin, int max): initialize the array by filling it with values between min and max. public static int[][] sum (int [][] a, int [][] b): compute the sum of two arrays and return anew array with those values. Remember, each value in array a gets added to the corresponding value in array b. Assume that the arrays are the same size. public static void reverse (int [][] a): reverse all the values in the array public static int [][] copy (int [][] a): create a new array that is a value-by-value copy of the argument array. public static void printArray (int [][] a): print the values stored in the array In your main () method prompt the user to enter two integers that will be the rows and columns for two arrays. Use your methods to initialize both arrays, to compute the sum and store it in a new array, to create a copy of one of your arrays and to reverse one of them. Print out your results as you go along. Sample output should appear on D2L before too long but get started!Explanation / Answer
package com.example.mohitdixit.myapplication; import java.util.Random; import java.util.Scanner; public class ArrayCompute{ public static void initialize(int[][]a, int min, int max){ Random random = new Random(); int randomNumber = random.nextInt(max - min) + min; for (int i = 0; i = 0; col--){ reverse[row][col] = a[rows-row][cols-col]; System.out.print(a[row][col]+" "); } }*/ } public static int[][] copy(int[][]a){ int [][] copyArray = new int[a.length][]; for(int i = 0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.