Question: You are to design and implement a Java Class named Matrix, here is what you need to do. Include 3 attributes, rows, columns and a
You are to design and implement a Java Class named Matrix, here is what you need to do. Include 3 attributes, rows, columns and a 2D array for the actual matrix A constructor that takes the number of rows and columns of the 2D array as parameters from client and instantiates it. A method called copyMatrix that returns a copy of a Matrix object. (Do not clone!!) A method called equals that returns true if two Matrix objects are the same, otherwise returns false. Two Matrix objects are the same if they have the same number of rows and columns, and the value Ai, j of Matrix A's 2D array is equal to value Bi, j of Matrix B's 2D array. A toString method that returns a properly formatted String that contains at- tributes of a Matrix object. A toString method in a Java class always returns a String that contains the current state of the Object. The current state is represented by Object's attributes. A method called scalarMultiply to multiply a Matrix by scalar in which every value Ai j in Matrix A's 2D array is multiplied by a scalar value k. See details in Figure 2. You only need to pass value k as a parameter to this method. A method to multiply called multiply a Matrix by another Matrix. If the number of columns in Matrix A's 2D array is not equal
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
