class Array public static int getTotalintnumbers int tot0

class Array
{
public static int getTotal(int[][]numbers )
{
int tot=0;
// Lo0op repeats until list ends
for (int row = 0;row < numbers .legth; row++)
for (int col=0 ;col< numbers [row].length; col++)
tot+=numbers [row][col];

return tot;
}
// return avarage
public static double getAvarage(int [][]numbers,int index)
{
double avg;
avg=(double) (getTotal(numbers/(12));
return avg;
}
public static int getRowTotal (int [][] numbers, int index)
{
int tot=0;
// loop repeats until list ends
for (int col=0;col<4;col++)
// Accumulates sum of numbers
tot+= number[index][col];
return tot;
}
public static int getHighest(int [][] numbers, int row)
{
int high= numbers [row][0];
// Loop repeats until list ends
for (int i = 1; i<4; i++)
if (numbers[rows][i]>high )
high = numbers [row] [i];
return high;
}
public static int getLowest (int [][]number,int row)
{
int low = number [row][0];
// Loop repeats until list ends
for(inti = 1 ;i < 4 ;i++)
if (numbers [row][i]<low)
low = numbers [row][i];
return low;
}
}
}

import java.io.*;

class ArrayDemo
{
// main function
public static void main (String []arg)
int [][]list= {{1,2,3,4},{5,6,7,8},{9,10,11,12}};
//Function call and display data returned
System.out.println(\"total:\"+getTotal(list));
System.out.println(\"Average:\"+getAverage(list));
System.out.println(\"Row 2 value:\"+ getRowTotal(list,2));
System.out.println(\"column3 value:\"+ getColumnTotal(list,3));
System.out.println(\"highest value in row 1 is:\"+getHighest(list,1));
System.out.println(\"lowest value in row 2 is:\"+getLowest(list,2));

// exit program
System.exit(0);
}


help me there are 48 mistakes

Solution

class ArrayDemo {

   // main function

   public static void main(String[] arg) {

       int[][] list = { { 1, 2, 3, 4 }, { 5, 6, 7, 8 }, { 9, 10, 11, 12 } };

       // Function call and display data returned

       System.out.println(\"total:\" + getTotal(list));

       System.out.println(\"Average:\" + getAverage(list));

       System.out.println(\"Row 2 value:\" + getRowTotal(list, 2));

       System.out.println(\"column3 value:\" + getColumnTotal(list, 3));

       System.out.println(\"highest value in row 1 is:\" + getHighest(list, 1));

       System.out.println(\"lowest value in row 2 is:\" + getLowest(list, 2));

       // exit program

       System.exit(0);

   }

   public static int getTotal(int[][] numbers) {

       int tot = 0;

       // Lo0op repeats until list ends

       for (int row = 0; row < numbers.length; row++)

           for (int col = 0; col < numbers[row].length; col++)

               tot += numbers[row][col];

       return tot;

   }

   // return average

   public static double getAverage(int [][]numbers)

   {

       double avg;

       avg=(double) getTotal(numbers)/12;

       return avg;

   }

   public static int getRowTotal(int[][] numbers, int index) {

       int tot = 0;

       // loop repeats until list ends

       for (int col = 0; col < 4; col++)

           // Accumulates sum of numbers

           tot += numbers[index][col];

       return tot;

   }

   public static int getHighest(int[][] numbers, int row) {

       int high = numbers[row][0];

       // Loop repeats until list ends

       for (int i = 1; i < 4; i++)

           if (numbers[row][i] > high)

               high = numbers[row][i];

       return high;

   }

   public static int getLowest(int[][] numbers, int row) {

       int low = numbers[row][0];

       // Loop repeats until list ends

       for (int i = 1; i < 4; i++)

           if (numbers[row][i] < low)

               low = numbers[row][i];

       return low;

   }

  

   public static int getColumnTotal(int[][] numbers, int column) {

       int sum = 0;

       for(int i = 0; i < numbers.length; i++)

           sum += numbers[i][column];

       return sum;

   }

}

class Array { public static int getTotal(int[][]numbers ) { int tot=0; // Lo0op repeats until list ends for (int row = 0;row < numbers .legth; row++) for (in
class Array { public static int getTotal(int[][]numbers ) { int tot=0; // Lo0op repeats until list ends for (int row = 0;row < numbers .legth; row++) for (in
class Array { public static int getTotal(int[][]numbers ) { int tot=0; // Lo0op repeats until list ends for (int row = 0;row < numbers .legth; row++) for (in
class Array { public static int getTotal(int[][]numbers ) { int tot=0; // Lo0op repeats until list ends for (int row = 0;row < numbers .legth; row++) for (in

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site