Create the class matrix to represent two-d double arrays


Programming Assignment

Creating a Matrix Class

In this assignment, you are to create the class Matrix to represent two-dimensional double arrays. The class will have the data members: 

   double [][] matrix 
   int numRows 
   int numCols

Constructors

   Null constructor - create a 5x5 matrix 
   Parameterized constructors: 
      (int numR, int numC) - creates a numR x numC matrix 
      (Matrix a) - creates a deep copy of the matrix a 
      (double [][] mat) - create an object of type matrix whose contents is mat

Mutators:

   void fill (double value) - sets the contents to value 
   void scalarMult (double value) - multiples each element by value

Manipulators:

Matrix addMatrix (Matrix a) - Two matrices can be added together if they are the same size. This method will add (if possible) two matrices together element by element and return the result. It will not modify either matrix used in the addition. If addition is not possible, the method should return null.

Matrix multMatrix (Matrix a) - Two matrices A and B can be multiplied A*B if  the number of columns of A is equal to the number of rows of B.  This method will multiple (if possible) the two matrices together creating and returning the result. It will not modify either matrix used in the operation. If multiplication is not possible, the method should return null.

void displayMatrix() - will display the matrix in row major order, without modifying the matrix

Matrix transpose() - will create and return the transpose of the matrix, without modifying the original matrix.

Format your assignment according to the following formatting requirements:

1. The answer should be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides.

2. The response also include a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.

3. Also Include a reference page. The Citations and references should follow APA format. The reference page is not included in the required page length.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Create the class matrix to represent two-d double arrays
Reference No:- TGS02957407

Now Priced at $100 (50% Discount)

Recommended (95%)

Rated (4.7/5)