Starting from:

$10

Methods in Java Solution

Write the following methods in a Java program: a) A Java method GenerateArray that shall fill a 2D array randomly. The method input parameters are a 2D array A and two number (a, b). The numbers a and b represents the interval in which you must generate the random numbers for the array.

b) A Java method Print2DArray that shall print the elements of 2D array. The method input parameters are an array A.

c) A Java method AddMatrix .This method shall add two matrices A and B and return the resulted matrix. The input parameters are two matrices A and B.

d) A Java method MultiplyMatrix. This method shall multiply two matrices A and B and return the resulted matrix. The method parameters are: array A and array B

e) Write the main method to display all the call and results of the previous methods.

Hint: To multiply 2 matrices?

Step 1: Make sure that the number of columns in the 1st one equals the number of rows in the 2nd one.

Step 2: Multiply the elements of each row of the first matrix by the elements of each column in the second matrix.

Step 3: Add the products

More products