Question: Create a class called 'Matrix' containing constructor that initializes the number of rows and number of columns of a new Matrix object. The Matrix class
Create a class called 'Matrix' containing constructor that initializes the number
of rows and number of columns of a new Matrix object. The Matrix class has the
following information:
1 - number of rows of matrix (attribute)
2 - number of columns of matrix (attribute)
The Matrix class has methods for each of the following:
1 - get the number of rows
2 - get the number of columns
3 - set the elements of the matrix at given position (i,j)
4 - adding two matrices. If the matrices are not addable, "Matrices cannot be
added" will be displayed.
5 - multiplying the two matrices
In the main method, create two objects of the matrix class. Add and Multiply the
matrices and show the result.
solve the problem using java.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
