1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Gemiola [76]
2 years ago
5

In java I need help on this specific code for this lab.

Computers and Technology
1 answer:
rosijanka [135]2 years ago
8 0

Answer:

Explanation:

The following code is written in Java and creates the two methods as requested each returning the desired double[] array with the averages. Both have been tested as seen in the example below and output the correct output as per the example in the question. they simply need to be added to whatever code you want.

public static double[] rowAvg(int[][] array) {

       double result[] = new double[array.length];

     for (int x = 0; x < array.length; x++) {

         double average = 0;

         for (int y = 0; y < array[x].length; y++) {

             average += array[x][y];

         }

         average = average / array[x].length;

         result[x] = average;

     }

     return result;

   }

   public static double[] colAvg(int[][] array) {

       double result[] = new double[array[0].length];

       for (int x = 0; x < array[x].length; x++) {

           double average = 0;

           for (int y = 0; y < array.length; y++) {

               average += array[y][x];

           }

           average = average / array.length;

           result[x] = average;

       }

 

       return result;

   }

You might be interested in
List and discuss five economic growth indicators
patriot [66]
Strong employment numbers. To see economic growth there needs to be an increase in Gross Domestic Product (GDP). ...
Stable Inflation. ...
Interest rates are rising. ...
Wage Growth. ...
High Retail Sales. ...
Higher New Home Sales. ...
Higher Industrial Production.
5 0
1 year ago
What considerations should you make when deciding on the size of a table?
Kisachek [45]

Answer:

You should consider the number of cells needed for data, labels, titles, and formulas.

Explanation:

4 0
2 years ago
Ano ang maikling kwento??
marishachu [46]

Answer with Explanation:

Ang "maikling kuwento" ay isang uri ng<em> kathang-isip</em> na may pagkapareho sa nobela. Ito'y may buong tema ngunit mas maikli kaysa sa nobela at mas madali rin itong matapos basahin. Hango ito sa mga tunay na pangyayari sa buhay ng tao. Binubuo ito ng limang elemento: <em>tauhan, tagpuan, hidwaan, tema at plot. </em>Ito'y may balak na pukawin ang damdamin ng nagbabasa ayon sa kalagayan ng mga tauhan sa kuwento at ito'y nag bibigay ng mabuting aral.

Si <em>Edgar Allan Poe</em> ang tinaguriang<em> "Ama ng Maikling Kuwento." </em>

3 0
3 years ago
Difference between website and web server
Volgvan

Answer:

a web server is a computer than runs websites

7 0
3 years ago
Read 2 more answers
What is the best way to catch a particular sporting moment?
pochemuha

Answer:

Know the sport really well so you can anticipate the moment when something exciting might happen. - c

3 0
3 years ago
Read 2 more answers
Other questions:
  • In JavaScript, which of the statements below can be used for string declaration?
    11·1 answer
  • The ________ Web, originally envisioned by Tim Berners-Lee, one of the founders of the Internet, is a set of design principles t
    15·1 answer
  • Look at the data set below. {9, 12, 12, 15, 18, 20, 25} in this data set, what is the median
    5·2 answers
  • Directory servers from different vendors are synchronized through ________.
    9·1 answer
  • What is the difference between a manufacturing engineer and a materials engineer?
    7·2 answers
  • Write a program to compute answers to some basic geometry formulas. The program prompts the user to input a length (in centimete
    7·1 answer
  • Word can store a maximum of how many documents in its Recent Documents area? five ten fifteen twenty
    8·1 answer
  • Compare and contrast CD and DVD?
    10·2 answers
  • Your baby brother has found the hammer and is eagerly eyeing one of the boxes. Describe and analyze an algorithm to determine if
    15·1 answer
  • The data _____ component of a database management system (DBMS) is used to create and maintain the data dictionary.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!