Write a java program to perform matrix multiplication -


In this project you need to write a java program called "MM.java" to perform matrix multiplication. Your code will read in two input files named"matrixA.txt" and "matrixB.txt", and then create a file named"matrixAnswer.txt" and output the result to the file.

Input and Output:

Your code will need to be able to read in these files, place the contents of each file into separate two-dimensional arrays and then perform the needed multiplication and place the output of the multiplication into a third two-dimensional array then write the array out into a file.

Please check the sample input files"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.

Please check the sample output file "matrixAnswer.txt".

1. matrixAnswer.txt is the matrix by multiplying 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 can't presume the size 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, 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 to do multiplication then your program should generate the right product of the two matrices.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Write a java program to perform matrix multiplication -
Reference No:- TGS0656174

Now Priced at $40 (50% Discount)

Recommended (92%)

Rated (4.4/5)