Average a Row in 2D Array

The following 2D array stores prices of meals for 5 days.
It has 3 rows and 5 columns.

   double[][] prices ={
                                {4.00 ,  4.50 , 5.95 ,   0  ,  1.95} ,
                                {  0   , 12.50, 3.50 ,   0  ,     0  },
                                {5.00 , 19.95,29.50,   0  , 10.00}
                             };

Write a method that accepts an int as a parameter - 0, 1, or 2 - and adds up the prices in that row and calculates the average.  It should return the average price of that row.

Solution

public  double  rowAverage( int  row )
{
   double  sum = 0;

   for(int c = 0; c < 5; c = c+1)
   {
        sum = sum + prices[row][c] ;
   }

   double average =  sum / 5;
   return  average;
}