:?: I got this far....but its not giving me the required output....can you give me some directions....here are my codes....thanks....please refer to my pdf file for the question.
//import java.lang.*;
import java.math.*;
import java.io.*;
class MatMulti extends Thread
{
static int in1[][];
static int in2[][];
static int out[][];
static int n=2;
int row;
MatMulti(int i)
{
row=i;
this.start();
}
public void run()
{
int i,j;
for(i=0;i<n;i++)
{
out[row]=0;
for(j=0;j<n;j++)
out[row]=out[row]+in1[row][j]*in2[j];
}
}
public static void main(String args[])
{
int i,j;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter the order of Matrix A : ");
try
{
n=Integer.parseInt(br.readLine());
}catch(Exception e){}
in1=new int[n][n];
in2=new int[n][n];
out=new int[n][n];
System.out.println("Enter the First Matrix : ");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
try
{
in1[j]=Integer.parseInt(br.readLine());
}catch(Exception e){}
}
}
System.out.println("Enter the Second Matrix : ");
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
try
{
in2[j]=Integer.parseInt(br.readLine());
}catch(Exception e){}
}
}
MatMulti mat[]=new MatMulti[n];
for(i=0;i<n;i++)
mat=new MatMulti(i);
try
{
for(i=0;i<n;i++)
mat.join();
}catch(Exception e){}
System.out.println("OUTPUT :");
for(i=0;i<n;i++)
for(j=0;j<n;j++)
System.out.println(out[j]);
}
}

Tell us what it is you think you need to do with this code, and try to solve it yourself. you should just put the small snippet of code that shows how you would like to solve the problem, then we can help you.

Also, put your code within [ CODE ] [ / CODE ] tags. Otherwise it is hard to help you.


Ed

Tell us what it is you think you need to do with this code, and try to solve it yourself. you should just put the small snippet of code that shows how you would like to solve the problem, then we can help you.

Also, put your code within [ CODE ] [ / CODE ] tags. Otherwise it is hard to help you.


Ed

hello ED!!
If you refer to my pdf file.....thats the out put i want
firstly the size of matrix...then input first matrix by user using dialog box and so on......but the output is displayed on command prompt
eg:
Matrix A:
1.0 2.0 3.0
4.0 5.0 6.0

Matrix B:
7.0 8.0 9.0
0.0 9.0 8.0
7.0 6.0 5.0

Product of Matrix A and B
28.0 44.0 40.0
70.0 113.0 106.0

thanks
Rashil

I don't want to solve your homework for you. Start thinking about how you will solve it and post your ideas/code snippets/pseudocode here. Then people will help you.


Ed

This article has been dead for over six months. Start a new discussion instead.