Specifications:

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.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.