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
Look at the logic program below. Set a breakpoint after each commented instruction. You can also single step through the program
Goshia [24]

Using programming knowledge, it is possible to use programming logic, we can differentiate and find the terms

<h3>Writing the code and understanding the programming logic:</h3>

<em>.data</em>

<em>sourceword:</em>

<em>.word 0xAB</em>

<em>wordmask:</em>

<em>.word 0xCF</em>

<em>operand:</em>

<em>.long 0xAA</em>

<em>.text</em>

<em>.globl _start</em>

<em>_start:</em>

<em>movw sourceword, %ax # ax=0x00AB ( move the word value of sourceword =0x00AB to ax register.)</em>

<em>movw %ax, %bx # bx=0x00AB ( copy the value of ax to bx register.)</em>

<em>xorw %cx, %cx # cx=0000 ( cx=cx XOR cx, that is clear cx register.)</em>

<em />

<em>andw wordmask, %ax # ax=0x008B ( ax=ax AND wordmask= 0x00AB AND 0x00CF= 0x008B)</em>

<em>orw wordmask, %bx # bx=0x00EF (bx=bx OR wordmask= 0x00AB OR 0x00CF= 0x00EF.)</em>

<em>xorw wordmask, %cx # cx=0x00CF (cx=cx XOR wordmask= 0x0000 XOR 0x00CF=0x00CF.)</em>

<em />

<em>movl operand, %eax # eax=0x000000AA. ( copy the 32-bit value of operand=0x000000AA to eax.)</em>

<em>movl %eax, %ebx # ebx=0x000000AA.( copy the value of eax to ebx.)</em>

<em>movl %eax, %ecx # ecx=0x000000AA. ( copy the value of eax to ecx.)</em>

<em />

<em>shll $3,%eax # eax=0x00000550. ( logical shift left of eax=0x000000AA by 3 bits.)</em>

<em />

<em># 0x000000AA=00000000000000000000000010101010</em>

<em />

<em># =>00000000000000000000010101010000=0x00000550.</em>

<em />

<em>rorl $4,%ebx # ebx=0xA000000A. (Rotate right ebx=0x000000AA by 4 bits.)</em>

<em />

<em># 0x000000AA=00000000000000000000000010101010</em>

<em />

<em>3 =>10100000000000000000000000001010= 0xA000000A.</em>

<em />

<em>sarl %ecx # here the count value to shift the bits not mentioned.</em>

<em />

<em># It is the arithmetic shift right instruction. the shifted left bits filled with MSB bit.</em>

See more about logic program at brainly.com/question/14970713

#SPJ1

5 0
2 years ago
The web server software used has a significant impact on how a web site's web pages look on a user's computer.
soldi70 [24.7K]
False. Apache (which serves about 63% of the web pages) just serves the files. How it looks is a combination of the HTML and CSS that the site uses.
6 0
3 years ago
Where should your two index fingers be when your fingers are rest.
PSYCHO15rus [73]

Answer: B : F and J

Explanation: Allows you to type without looking at keys and makes all the keys easily accessible

5 0
2 years ago
ICT4AD was meant to modernize the civil service through E-governance implementation.
astra-53 [7]

ICT4AD work through E-governance implementation fail as a result of:

  • Lack of Infrastructure.
  • High cost of running its affairs as it needs  huge public expenditure.
  • Issues with Privacy and Security and others.

<h3>What is the aim of e-governance?</h3>

The objectives of e-Governance is created so as to lower the level of corruption in the government and to make sure of  fast administration of services and information.

Conclusively, It is known to fail due to the reasons given above and if they are worked on, the service would have prospered.

Learn more about civil service from

brainly.com/question/605499

7 0
2 years ago
HELP LOTS OF POINTS! I WILL GIVE YOU 100+ POINTS IF ANSWERED CORRECTLY!!!
Delicious77 [7]

Answer:

E) all of the above

Explanation:

Your device can track your location, which means that it will tell where you've been. When you post on social media or just online, you are sharing what you're thinking. Your friends and family can easily be traced back to you, so they know who your friends and family are, and we leave evidence of what we've done because whatever you click gets tracked. hope this helps :)

4 0
2 years ago
Other questions:
  • 2. Identify the diagram and define it.<br>13. What are pollen grains ?<br>4. What is an embryo?​
    12·1 answer
  • : how can you reduce file size so that files can be sent more efficiently across the internet
    5·1 answer
  • A switch is a central network device that connects network nodes such as workstations and servers in a physical ____ topology
    14·1 answer
  • 1. When centering one paragraph on a page of text, the user needs to _____.
    15·2 answers
  • Jeremy is designing a website for a florist. He intends to discuss the web design with his client. Which tool should Jeremy use
    6·1 answer
  • How do you copy and paste plz let me know
    14·2 answers
  • 1. Define lexemes. Give an example of an lexeme in any programming language.<br>​
    10·1 answer
  • What is the definition of trouble shooting.
    12·1 answer
  • I used a walmart MoneyCard and now it says its prepaid. Its my dad's card.
    12·1 answer
  • Desktop and personal computer are also known as​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!