Java HandWritten Matrix LabCreate a class IntMatrix with:con
Need help with this assignment?Get an original answer from a qualified tutor — from $10/page.
Get it written →Java HandWritten Matrix LabCreate a class IntMatrix with:constructor with parameters for #rows, #colsset method to set a single cell (three params). Print out an error if row or column is invalid.numCols and numRows methods that return #rows and #cols.sum method that returns sum of all cells in matrix.rowSum method that returns the sum of a particular row in the matrixmin method that returns the minimum of all cells.toString that prints out as a matrix (rows and cols)equals methodextra credit: addRows and addCols methods that dynamically resize the matrix.Provide a main that tests all methods, see example below:IntMatrix matrix = new IntMatrix(2,3);matrix.set(0,0,99);matrix.set(1,1,88);matrix.set(5,3,77); // should print out errorSystem.out.println(‘matrix is: ‘+matrix);System.out.println(‘matrix numRows is’+matrix.numRows());System.out.println(‘matrix sum is’+matrix.sum());System.out.println(‘matrix sum of 2nd row is’+matrix.rowSum(1));System.out.println(‘matrix min is’+matrix.min());IntMatrix matrix2= new IntMatrix(2,3);matrix2.set(0,0,99);matrix2.set(1,1,88);IntMatrix matrix3= new IntMatrix(2,3);matrix3.set(0,0,44);matrix3.set(0,1,22);if (matrix.equals(matrix2)) System.out.println(‘matrix equals matrix2’); // should printif (matrix.equals(matrix3)) System.out.println(‘matrix equals matrix3’); // should not print
Get a plagiarism-free answer to this question
Send us your instructions and we’ll match you with the best writer in your subject.
- 100% human-written, zero AI
- Turnitin report included
- Confidential — we never share your data
- Free revisions & refunds