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
Using the SUM function allows a series of numbers to be 1. Multiplied 2. Subtracted 3 Added 4. Divided
MA_775_DIABLO [31]

Based on the name, i'm gonna go ahead and guess 3. Added.


sum

/səm/Submit

noun

1.

a particular amount of money.

"they could not afford such a sum"

synonyms: amount, quantity, volume More

2.

the total amount resulting from the addition of two or more numbers, amounts, or items.

"the sum of two prime numbers"

synonyms: (sum) total, grand total, tally, aggregate, summation

"the sum of two numbers"


4 0
3 years ago
Robyn needs to ensure that a command she frequently uses is added to the Quick Access toolbar. This command is not found in the
Semenov [28]

Answer: Access Quick Access commands using the More button

Explanation:

In order for Robyn to ensure that a command she frequently uses is added to the Quick Access toolbar, then she needs to Access Quick Access commands using the More button.

This can be done by clicking on Customize Quick Access Toolbar. Then, Robyn will then click More Commands then he'll click on file tab in the Choose commands from the list. The command will then be chosen and then click on Ok and it'll be added.

7 0
3 years ago
What data type can be used to hold any single character, including numbers and non-printing characters?
SVEN [57.7K]

Answer:

char

Explanation:

The character data type written as char holds any single character, numbers and non-printing characters. In java and most programming languages, the value of the character must be placed within single quotes. for example

char c = 'd'

char c = '9'

char c = '\t'

Are all valid declarations of a variable c as char and assigned d, then 9 and then used with a non-printing character (tab ) with the escape sequence.

8 0
3 years ago
Read 2 more answers
Always place the smallest dimensions ____ the object, with ____ the object.
allsm [11]
The answer is B (Closest to; progressively larger dimensions outward from
8 0
3 years ago
Which best explains why the world first civilizations developed in river valley's
fiasKO [112]
They need to be close to a body of water and being in a valley is good because they are protected because they have mountains around
4 0
3 years ago
Other questions:
  • Choosing firm goals for your business
    7·2 answers
  • What is a CPU or a GPU? What’s the difference? Which one is better?
    5·1 answer
  • What is a thesaurus is best used for​
    11·2 answers
  • Which of the following is a reason that a drug may not receive FDA approval?
    15·1 answer
  • Please help! In your own words explain the difference between a problem and an algorithm.
    13·2 answers
  • Write a program that reads a list of integers, and outputs those integers in reverse. The input begins with an integer indicatin
    6·1 answer
  • Which option should you select to ignore all tracked changes in a document? To ignore all tracked changes in a document, you sho
    14·1 answer
  • We know that February has either 28 or 29 days, but there is a year in the future, February will have 30 daysWhat exactly is thi
    15·1 answer
  • How to recover deleted photos after deleting from recently deleted
    13·2 answers
  • Which of the following variables are string types?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!