So I have a problem... according to the specification given by my lab TA, we must

"write a Microsoft Visual Studio console application that will calculate the

following four operations over the elements of a two dimensional array (matrix) of integers:

1. Sum

2. Average

3. Max

4. Min

All of these operations must be performed recursively. (See the design hints on the following

pages. No credit will be given for a simple sequential algorithm!) The program must

work with a matrix of any size. The size will be given as input."

We are also given that

"The class must have the following methods:

1. public int Sum(int[,] matrix, rowNum, colNum)

2. public int Average(int[,] matrix, rowNum, colNum)

3. public int Max(int[,] matrix, rowNum, colNum)

4. public int Min(int[,] matrix, rowNum, colNum)"

and

The method Main should be in its own class. Main should not be in class MatrixCalculator. In

Main, you will perform the following:

1. Read from console the number of rows for the matrix.

2. Read from console the number of columns for the matrix.

3. Create the matrix and read from console each of the numbers to initialize it. (For

example, if the number of rows is 3 and the number of columns is 3 you need to read 9

numbers.)

4. After reading the numbers display the matrix and a menu with the four operations and

a fifth option “Exit”.

5. When an option is selected, perform the operation and show the result. (Use a switch

statement to invoke the appropriate method).

6. After performing an operation, display the menu and wait for the user to select another

option.

7. The program terminates when the option “Exit” is selected.

The thing I have a problem with is how the heck do I recursively perform those four operations? Even the TA admits this is a stupid way to do this, but for some reason it's still our assignment... Being an inexperienced programmer I am horribly confused by recursive crap and even more so since a 2D array is involved... I have no idea what to do... this is what I've tried so far, but I can't really seem to get it...

```
namespace Assignment2
{
class MatrixCalculator
{
//Sums the elements in an array
public int Sum(int[,] matrix, int rowNum, int colNum)
{
if (colNum == matrix.Length)
{
return Sum(matrix, rowNum + 1, 0);
}
else if (rowNum == matrix.Length)
{
return 0;
}
else
{
return (matrix[rowNum, colNum] + Sum(matrix, rowNum, colNum + 1));
}
}
//Calculates the average of the elements in an array
public int Average(int[,] matrix, int rowNum, int colNum)
{
}
//Finds the maximum valued element in array
public int Max(int[,] matrix, int rowNum, int colNum)
{
}
//Finds the minimum valued element in array
public int Min(int[,] matrix, int rowNum, int colNum)
{
}
}
}
```

and for my other class:

```
namespace Assignment2
{
class Recursion
{
static void Main(string[] args)
{
MatrixCalculator matrix = new MatrixCalculator();
}
}
}
```

I'm completely stuck. Our lecture professor didn't explain this stuff very well.