Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a class that has the following methods. Use nested for loops for all of th

ID: 3654814 • Letter: W

Question

Write a class that has the following methods. Use nested for loops for all of these array operations: public static void printArray (int[][] a): print the value stored in the array public static int sum (int[][] a): compute and return the sum of the values in the array public static int sum (int[][] a), (int[][] b) : compute the sum of two arrays and return a new array with those values. Remember, each value in array in gets added to the corresponding value in array b. Assume that the arrays are the same size. public static : return true if the value n is found in the array, Return false if it is not found. In your main () method prompt the user to enter two integers that will be the rows and columns for two 2D arrays. Create the arrays according to the input dimensions and fill them with random values from 0 to 15. Then prompt for a third integer that will be used to test your is found () method. Remember, to do all input and output in your main() method. Pass the input to your methods and collect the results using assignment statements. You don't need to do any input checking. Assume the user enters appropriate value. I suggest your write and test your methods one at a time. You can get part marks for the methods that work.

Explanation / Answer

import java.io.*; import java.util.Random; class Twodarray { static int row,col; static BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); public static void main(String args[])throws IOException { Random r = new Random(); int i,j,ser; System.out.print("Enter the number of rows required : "); row=Integer.parseInt(br.readLine()); System.out.print("Enter number of columns required : "); col=Integer.parseInt(br.readLine()); int a[][]=new int[row][col]; for(i=0;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote