Question: Write a method called getIndexOfTrueColumn that takes a 2 dimensional array of boolean values as a parameter, and determines which column in this 2D array

 Write a method called getIndexOfTrueColumn that takes a 2 dimensional array

of boolean values as a parameter, and determines which column in this

Write a method called getIndexOfTrueColumn that takes a 2 dimensional array of boolean values as a parameter, and determines which column in this 2D array has the maximum number of elements equal to true. The method returns the index of the column that has the most elements equal to true. If there is a tie between two or more columns return the smallest index. For example, if the following 2D array was passed to the method: 0 1 2. 0 true false true 1 2. 3 4 true false true false false false true true false false false false Columns 0 and 3 are tied with the maximum number of elements equal to true with 2 elements each. In this case the method would return 0 to indicate column o has the maximum number of elements equal to true. You should check if the array is not equal to null, the length is greater than 0. Assume that of columns You Columns 0 and 3 are tied with the maximum number of elements equal to true with 2 elements each. In this case the method would return 0 to indicate column o has the maximum number of elements equal to true. You should check if the array is not equal to null, the length is greater than 0. Assume that there is at least one column per row, and each row has the same number of columns. You should NOT modify the array as a result of this method. Write a method called getIndexOfTrueColumn that takes a 2 dimensional array of boolean values as a parameter, and determines which column in this 2D array has the maximum number of elements equal to true. The method returns the index of the column that has the most elements equal to true. If there is a tie between two or more columns return the smallest index. For example, if the following 2D array was passed to the method: 0 1 2. 0 true false true 1 2. 3 4 true false true false false false true true false false false false Columns 0 and 3 are tied with the maximum number of elements equal to true with 2 elements each. In this case the method would return 0 to indicate column o has the maximum number of elements equal to true. You should check if the array is not equal to null, the length is greater than 0. Assume that of columns You Columns 0 and 3 are tied with the maximum number of elements equal to true with 2 elements each. In this case the method would return 0 to indicate column o has the maximum number of elements equal to true. You should check if the array is not equal to null, the length is greater than 0. Assume that there is at least one column per row, and each row has the same number of columns. You should NOT modify the array as a result of this method

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!