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]
2 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]2 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
This may vary in your state, but S/P2 recommends keeping all environmental documentation a minimum of:
Anettt [7]

A would be the answer!!!...

4 0
2 years ago
Read 2 more answers
If you attempt an edgeunity quiz is your latest attempt the one counted?
tekilochka [14]

Answer:

Hello

Explanation:

Hello profile picture of a nub how are you doing today?

8 0
3 years ago
How many comparisons will be made to find 8 in this list using a linear search?
Kobotan [32]

Answer:

4

Explanation:

4

6 0
2 years ago
Nurse Jackie is a humorous depiction of a drug-addicted nurse who struggles to balance the demands of her hectic hospital job wi
11Alexandr11 [23.1K]

Answer:

dramedy would make since to me

Explanation:

3 0
3 years ago
Type the correct answer in the box. Spell all words correctly.
Serggg [28]

Answer:

Consistency

Explanation:

Making a website consistent helps people understand the goal and functions of a website, while also keeping the design the same the whole way through.

3 0
2 years ago
Read 2 more answers
Other questions:
  • What technology gets its name from the notion that it ignores the traditional A, B, and C class designations for IP addresses?
    14·1 answer
  • The performance of a client-server system is strongly influenced by two major network characteristics: the bandwidth of the netw
    6·1 answer
  • What is the most important external issue when using social media in emergency management?
    6·1 answer
  • What port in your computer will you use to plug in your camera?
    14·2 answers
  • A solid understanding of __________ is the foundation of verbal communication
    7·1 answer
  • How do the companies gather data to determine common passwords?
    13·1 answer
  • If you had an idea for a new software company, what would be the best approach to help make it a successful business? develop a
    5·2 answers
  • PLS HURRRYYYYYY!1!1!1!1!1
    5·2 answers
  • If you do not clean your hardware on a regular basis, which of these is most likely to be a problem?
    11·1 answer
  • Simplify the Boolean expression (AB(C + BD) + AB]CD.
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!