Example Array foo[][] data
Col 0
Col 1
Col 2
Col 3
Col 4
Col 5
Row 0
876
8
69876
1234
2354
3
Row 1
97
64
875
5
456
467
Row 2
75
765
89
1231344
456
23
Row 3
76
57
96
66
67
23
Last row
123
3887
78783
773
1
2
Complete the method code below so that the method will sum up the values of the even-numbered columns (including 0) of the array parameter foo as shaded in the table above.
The number of rows and columns are unknown and can be inferred from from the array itself. The last column may or may not be an even-numbered column. Make sure to account for this in your method.
Return the sum of those cells from the method.
You may only use two loops inside the method.
You do not need to write a complete program, but make sure that your method is complete and would compile if used inside a complete program.
Starter Code (copy and paste into answer box, use Courier New font, and then fill in relevant code)
/*
* method Name : sumArray
* Parameters : int array foo
* Task : sum even columns in matrix
* Return : the summation of all even columns
*/
public static int sumArray ( int foo [][] )
{
}