[SOLVED] Methods in Java

25.00 $

Programming resource
, Digital learning resource
Categories: ,
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (1 vote)
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

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.