Task
You are going to write a Java Program which does the following operations.
1. Read the size of a matrix n from the keyboard.
2. Create three integer matrices A[n][n], B[n][n] and C[n][n].
3. Use a method to fill up the two arrays A and B by positive and/or negative integer random numbers between 0 and 6 (Hint: to obtain negative numbers, just select randomly any positive integer number and convert it to negative).
4. Use a method to multiply the elements of the two matrices A and B and store the result in matrix C as shown in the example below.
5. Use a method to print the elements of matrix A in a two digit decimal format.
6. Use the same print method to print matrices B and C to the screen in the format shown in the example below.
The Equation and Pseudo Codes for Matrix Multiplication are shown below.
Cij = Aik * Bkj (for k = 1 to k = n)
For i = 1 to n
For j = 1 to n do
Cij = 0
For k = 1 to n
Cij = Cij + Aik * Bkj
Running Example of Matrix Multiplication:
What is the size of your Matrix (2-10)? 4
Matrix A:
-2 5 0 1
4 1 6 -3
1 2 -4 5
-6 0 2 1
Matrix B:
5 -6 1 -4
0 3 -4 3
3 1 2 0
4 -5 1 3
Matrix C = A*B:
-6 -2 -21 10
26 0 9 -22
13 -29 -10 17
-20 -39 -1 27