PLEASE DO NOT POST CODE ON HERE SEND TO jamanemo4yahoocom PL

*******************PLEASE DO NOT POST CODE ON HERE*******************

SEND TO: jama_nemo4@yahoo.com

PLEASE SEND ME ORGINIAL CODE WITH COMMENTS. PLEASE DO NOT SEND UNORIGINAL CODE.

Thank You!

Design a class to perform various matrix operations. A matrix is a set of numbers arranged in rows and columns. Therefore, every element of a matrix has a row position and a column position. If A is a matrix of 5 rows and 6 columns, we say that matrix A is of the size 5 X 6 and sometimes denote it as A5X6. Clearly, a convenient place to store a matrix is in a two-dimensional array. Two matrices can be added and subtracted if they have the same size. Suppose that A = [aij] and B =[bij] are two matrices of the size m n, in which aij denotes the element of A in the ith row and the jth column, and so on. The sum and difference of A and B is given by: A + B = [aij + bij] A - B = [aij -bij]

The multiplication of A and B (A * B) is defined only if the number of columns of A are the same as the number of rows of B. If A is of the size m n and B is of the size n t, then A * B = [cik] is of the size m x t and the element cik is given by the formula: cik = (a)i1( b)1k +( a)i2(b)2k + . . . + (a)in(b)nk

*******************PLEASE DO NOT POST CODE ON HERE*******************

SEND TO: jama_nemo4@yahoo.com

PLEASE SEND ME ORGINIAL CODE WITH COMMENTS. PLEASE DO NOT SEND UNORIGINAL CODE.

Thank You!

Solution

I am providing the answer here , as posting the code of somone\'s specific id is against policy.

class Matrix{

public static void main(String args[])

{

int a[][] = new int[][];

int b[][]= new int[][];

int c[][]= new int[][];

int i,j;

Scanner s = new Scanner(System.in);

System.out.println(\"Please enter the number of rows \");

i= s.nextInt();

System.out.println(\"Please enter the number of colums\");

j= s.nextInt();

System.out.println(\"enter the elements for Array a\");

for(int n =0;n<i;n++)

{for(int m=0;m<j;m++)

{

a[n][m] = s.nextInt();

}

}

System.out.println(\"enter the elements for Array b\");

for(int n =0;n<i;n++)

{for(int m=0;m<j;m++)

{

b[n][m] = s.nextInt();

}

}

//Addition of two matrices

for(int n=0;n<i;n++)

{

for(int m = 0;m<j;m++)

{

c[n][m] = a[n][m]+b[n][m];

}

}

//subtraction of two matrices

for(int n=0;n<i;n++)

{

for(int m = 0;m<j;m++)

{

c[n][m] = a[n][m]-b[n][m];

}

}

//Multiplication of two matrices

for(int n=0;n<i;n++)

{

for(int m = 0;m<j;m++)

{

c[n][m] = a[n][m]*b[n][m];

}

}

}

}

*******************PLEASE DO NOT POST CODE ON HERE******************* SEND TO: jama_nemo4@yahoo.com PLEASE SEND ME ORGINIAL CODE WITH COMMENTS. PLEASE DO NOT SE

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site