

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A test for a matrixpatterns class in java. The class has an instance variable which is a two-dimensional int array, a constructor that initializes and populates the array from a user-provided input file, and public methods printmatrix(), numrowones(), and numcolones(). The test driver provided prints the matrix and the number of rows and columns with all ones. Students are required to submit their work using handin.212.302 and are evaluated based on the correctness of their algorithm, selection of storage/data structure, and efficiency.
Typology: Exams
1 / 2
This page cannot be seen from the preview
Don't miss anything!


public static void main(String args[]) { MatrixPatterns mp = new MatrixPatterns("inputfile"); mp.printMatrix(); System.out.println(“Number of rows with all ones: “ + mp.numRowOnes()); System.out.println(“Number of columns with all ones: “ + mp.numColOnes()); } // end main