Create 2 text files each holding a 3x3 array ofnumbers. Your program should read them in , perform a matrixmultiplication and save to a new text file. Matrix(File1) Matrix (File2) Result matrix 2 3 4 1 2 3 2 6 12 5 2 2 3 2 1 ========= 15 4 2 3 2 3 2 2 2 6 4 6 Create 2 text files each holding a 3x3 array ofnumbers. Your program should read them in , perform a matrixmultiplication and save to a new text file. Matrix(File1) Matrix (File2) Result matrix 2 3 4 1 2 3 2 6 12 5 2 2 3 2 1 ========= 15 4 2 3 2 3 2 2 2 6 4 6
Explanation / Answer
please rate - thanks this goes to the screen and a file hope this solves the problem import java.io.*; import java.util.*; public class matrixMult { public static void main(String[]args)throws FileNotFoundException { int n,i,j; n=3; int [][] a = new int[n][n]; int [][] b = new int[n][n]; int [][] c = new int[n][n]; Scanner in1=new Scanner(newFile("mat1.txt")); Scanner in2=new Scanner(newFile("mat2.txt")); PrintWriter out1=newPrintWriter("mat3.txt"); for(i=0;i