Define the exceptions that are necessary to catch the possible errors that can occur in the class Matrix · ExceptionWrongMatrixValues that is thrown in the method read() if the data on the String does...



Subject: Object Oriented Prgramming


Language: Java Program
Topic: Exception



(SEE ATTACHED PHOTO FOR THE PROBLEM)



Initial code:



public class Matrix{
    private int matrix[][];

    public Matrix(){}

    public Matrix(int row, int column){
        matrix = new int[row][column];
    }

    //your methods here
}




Define the exceptions that are necessary to catch the possible errors that can occur in the<br>class Matrix<br>· ExceptionWrongMatrixValues that is thrown in the method read() if the data on the String<br>does not correspond to numeric values, or if the data are not consistent with the form of a<br>matrix (e.g., the rows have different length);<br>· ExceptionWrongMatrixDimension that is thrown in the method read() if the data on the<br>String do not correspond to the dimension of the matrix.<br>The numbers are separated by space. A dot in a string means the next string of text is for the<br>next row.<br>For example:<br>Test<br>Result<br>String input=

Extracted text: Define the exceptions that are necessary to catch the possible errors that can occur in the class Matrix · ExceptionWrongMatrixValues that is thrown in the method read() if the data on the String does not correspond to numeric values, or if the data are not consistent with the form of a matrix (e.g., the rows have different length); · ExceptionWrongMatrixDimension that is thrown in the method read() if the data on the String do not correspond to the dimension of the matrix. The numbers are separated by space. A dot in a string means the next string of text is for the next row. For example: Test Result String input="1 2 3 .1e 3."; ExceptionWrongMatrixValues Matrix m = new Matrix (); m.read (input); String input="1 2 3. 1 2 3 4 5 ."; ExceptionWrongMatrixValues Matrix m = new Matrix (); m.read (input); String input="12312345"; ExceptionWrongMatrixDimension Matrix m = new Matrix (); m.read (input); String input="1 2.3 4."; 1 2 Matrix m = new Matrix (); 3 4 m.read (input);

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here