In this project you need to write the java program MM.java to implement matrix multiplication.
Specifically, first your program reads two matrices A and B from the files named matrixA.txt and matrixB.txt (under the same directory), respectively. Then your program places the contents of each file into separate two-dimensional arrays, performs the needed multiplication, and places the output of the multiplication into a third two-dimensional array. Finally your program creates a file named matrixAnswer.txt (under the same directory) and prints the result array to matrixAnswer.txt. Please check the attached sample files matrixA.txt, matrixB.txt, and matrixAnswer.txt.
In matrixA.txt and matrixB.txt:
1.matrixA.txt is the file that contains the first matrix A. It has x rows and y columns. The numbers in each row are separated by one blank space.
2.matrixB.txt is the file that contains the second matrix B. It has y rows and z columns. The numbers in each row are separated by one blank space.
In matrixAnswer.txt:
1.matrixAnswer.txt is the file that contains the multiplication of matrix A and matrix B. Your program should create the file and output the result to the file. It has x rows and z columns. The numbers in each row are separated by one blank space.
Sample input files are provided but you cant presume the sizes of the input matrices. You will also need to check if it is legal to multiply both of these matrices together. If it is not legal (i.e. column size of A row size of B), you need to inform the user that you are unable to perform the multiplication. As long as the two input matrices have the legal sizes (i.e. column size of A = row size of B) to do multiplication then your program should generate the right product of the two matrices.