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]
3 years ago
5

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

Computers and Technology
1 answer:
rosijanka [135]3 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
Help debugging line 7 type error more arguments (5) than expected (1)
kolezko [41]

Answer:

import random

score = 0

for i in range(5):

   num1 = random.randint(1, 100)

   num2 = random.randint(1, 100)

   prompt = "What is " + str(num1) + "+" + str(num2) + "?"

   answer = int(input(prompt))

   result = (num1, num2)

   if answer == result:

       print("Well done!")

       score += 1

   else:

       print("incorrect")

print("Your score was", score)

Explanation:

Your error is on <em>line 7</em>, where you are providing multiple arguments to the input function, instead of 1.

One way to solve this is to create a variable prompt and concatenate all strings and variables within that variable to use for the input.

3 0
1 year ago
Compound conditions require a computer to sense whether multiple conditions are true or false.
Anna71 [15]

Answer:

False

Explanation:

You can have multiple conditions in your while and for loops as well as your if statements.

4 0
3 years ago
What wireless networking radio frequency yields faster speeds but offers shorter range ?
QveST [7]
<span>The wireless networking radio frequency 5GHz yields faster speeds but offers shorter range .
</span>One hertz is one complete cycle per second. <span> In </span>wireless communications<span>, it refers to wave oscillation. </span>Higher frequency can mean a faster system.
8 0
3 years ago
The algorithm ____ is used to find the elements in one range of elements that do not appear in another range of elements.
Musya8 [376]

Answer:

A. set_union

Explanation:

The algorithm set_union is used to find the elements in one range of elements that do not appear in another range of elements.

4 0
3 years ago
You may already have friendships with some team members, but not everyone. How should you behave as a team member? (choose all t
aivan3 [116]

Answer:

now as a team member you should help all your teammates

this is how you become a group and gets close to each other

in start it is difficult but when you encourage your friends to talk and have fun with other members , the you will become an elite team member or an outstanding one , to me option D out  of all options because when you mingle with others that makes the team even funnier

5 0
3 years ago
Read 2 more answers
Other questions:
  • . Consider the following brute-force algorithm for evaluating a polynomial. ALGORITHM Brute Force Polynomial Evaluation(P[0..n],
    14·1 answer
  • If your vehicle leaves the pavement for any reason, remember to take your foot off the gas pedal, hold the wheel firmly, and
    12·2 answers
  • After a worksheet has been displayed in page layout view, page breaks are indicated by ________ in normal view.
    14·1 answer
  • Please answer these questions! Will mark Brainliest!!
    7·1 answer
  • The _____ is the button that you push to take a photograph. i think its B Help PLZ
    5·1 answer
  • Which element is included in the shot breakdown storyboard? Which element is included in the shot breakdown storyboard?
    8·1 answer
  • Regarding computer protection, quarantining is defined as ________.
    9·1 answer
  • A company decides to relocate its operations to another state in order to take advantage of some new business investment credits
    15·1 answer
  • Connect 5 LEDs with any random colors. Iteratively, turn ON 1 to 5 LED(s) that will take 5 iterations in total, and in every ite
    6·1 answer
  • How does video conferencing change the way we work today?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!