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
Charra [1.4K]
3 years ago
11

Write the method public static doublell quizAverages (double (1 scores). which takes a 2D array of doubles that represent quiz s

cores for students in a course and returns an array of quiz averages. Specifically, each column represents a quiz, and each row represents a student in the class. Therefore, what the method returns is an array of column averages, essentially. Assume that all students take the same number of quizzes
Computers and Technology
1 answer:
Helga [31]3 years ago
8 0

Answer:

  1. import java.util.Arrays;
  2. public class Main {
  3.    public static void main(String[] args) {
  4.        double [][] studentScores = {
  5.                {78, 40, 97},
  6.                {89, 90, 68},
  7.                {70, 35, 88}
  8.        };
  9.        System.out.println(Arrays.toString(quizAverages(studentScores)));
  10.    }
  11.    public static double[] quizAverages(double [][] scores){
  12.        double average[] = new double[scores[0].length];
  13.        for(int col = 0; col < scores[0].length; col++){
  14.            double sum = 0;
  15.            for(int row =0; row < scores.length; row++){
  16.                sum += scores[row][col];
  17.            }
  18.            average[col] = sum / scores[col].length;
  19.        }
  20.        return average;
  21.    }
  22. }

Explanation:

The solution code is written in Java.

Firstly, create a static method that take one input parameter, double type two dimensional arrays and this method will return one array of average as required by question (Line 11).

In the method, declare a double type array and initialize its size with the length of the column of the input scores array (Line 12).

Create a double layer of for loop with outer loop to iterate through the column of the input score array and the inner loop to iterate through the row (Line 13-15). In the outer loop, create a sum variable to hold the value of summation for each column (Line 14). In the inner loop, increment the sum variable with the score in each row (Line 16). After finishing one inner loop cycle, the sum is divided by the length of column and assign it to an item of average array in outer loop before proceed to the next round of outer loop to repeat the same process (Line 18).

At last return the average array (Line 20).

We can test the method using a sample data (Line 4-8) and print out the output returned by the method (Line 9).  

You might be interested in
A __________ attack is a bot attack on a computer system or network that causes a loss of service to users.
PSYCHO15rus [73]

Answer:

DDos or Distributed Denial Of Service Attack

Explanation:

:)

4 0
1 year ago
Which of the following tools and techniques shows theimpacts of one decision over another as well as the probability andcost of
Nezavi [6.7K]

Answer: Probability/impact risk matrix

Explanation: Probability/impact risk matrix is type of matrix that defines the probability as well as impact that depicts whether the risk is low ,high or moderate.

Impact matrix is sort of tool which helps in conversion of any plan into a action. Probability matrix help in defining the chances in defining the risk.The positioning of the impact value of risk is plotted  on the vertical axis and performance value on the horizontal axis.

Thus probability/impact matrix is the correct tool for the problem mentioned in the question.

6 0
3 years ago
What is a secondary storage medium that uses magnetic techniques to store and retrieve data on disks or tapes coated with magnet
Elza [17]

Answer:

The correct answer to the following question will be "Magnetic medium".

Explanation:

Some storage device that portrays details or information using magnetic patterns is called a magnetic device.

  • Magnetic tape, and hard drives are the commonly used magnetic storage devices.
  • This will be the method by which magnetic methods are used to hold and retrieve information on tapes.

So, it's the right answer.

3 0
3 years ago
What allows a programmer to write code quickly and efficiently for an action that must be repeated?
Marta_Voda [28]
An literation :))!! i hope u get it right lol
6 0
2 years ago
Read 2 more answers
the central processing unit(CPU)is responsible for processing all information from program run by your computer.​
olasank [31]

Answer:

This is a true statement.

Further Explanation:

The CPU is technically the brain of a computer, containing all the circuitry required to process input, store data, and output results.

3 0
3 years ago
Other questions:
  • In Java :
    11·1 answer
  • Which information technology job has the lowest predicted 10-year growth? computer programmer software developer computer suppor
    13·1 answer
  • Prominent is another word for stands out. True False
    13·1 answer
  • If your problem is caused by a bad hardware or software installation and you get an error message the first time you restart the
    6·1 answer
  • Why is it important for software developers to study Human-Computer Interaction? to make sure a user interface is easy to use, w
    10·2 answers
  • The page orientation in which the page width is greater than the page height is called
    8·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    11·2 answers
  • Why is it NOT a good practice to save everything on the desktop?
    6·2 answers
  • Difference between statement x=+5 and x+=5​
    7·1 answer
  • which of the following indicates that the loop should stop when the value in the quantity variable is less than the number 50​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!