Question: Consider a class MatrixStuff that has a private instance variable: private int [ ] [ ] mat; Refer to method alter below that occurs in
Consider a class MatrixStuff that has a private instance variable: private int mat;
Refer to method alter below that occurs in the MatrixStuff class. The lines are numbered for reference.
Line : Oparam mat the matrix initialized with integers
Line : Oparam c the column to be removed
Line : Postcondition:
Line : Column has been removed.
Line : The last column is filled with zeros.
Line :
Line : public void alterint mat, int c
Line :
Line : for int ; mat.length;
Line : for int ; mat length;
Line : matmat;
Line : code to insert zeros in rightmost column
Line :
Line :
The intent of the method alter is to remove column Thus, if the input matrix mat is
table
the method call alter mat should change mat to
table
The method does not work as intended. Which of the following changes will correct the problem?
I Change line to
for int ; mat length ; and make no other changes.
II Change lines and to
for int matmatmatmat; length;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
