Question: public class Matrix { private int nRow, nCol; private double[] data; // must store as linear array unless 0 //getter for NRow - do not

public class Matrix

{

private int nRow, nCol;

private double[] data; // must store as linear array unless 0

//getter for NRow - do not modify

public int getNRow()

{

return nRow;

}

//getter for NCol - do not modify

public int getNCol()

{

return nCol;

}

/**

* set nRow to r if r is not negative, otherwise set nRow to 0

* @param r: value to be assigned to nRow

*/

public void setNRow(int r)

{

//to be completed

}

/**

* set nCol to c if c is not negative, otherwise set nCol to 0

* @param c: value to be assigned to nCol

*/

public void setNCol(int c)

{

//to be completed

}

/**

*

* @return true if both nRow and nCol are zero, false otherwise

*/

public boolean isEmpty()

{

return false; //to be completed

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!