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
Ratling [72]
2 years ago
6

Write a public static method diagSum, which takes a 2d array of int values as a parameter, and returns the sum of the elements i

n the lead diagonal as an int value. The lead diagonal is defined as the diagonal line of values starting in the top left corner and proceeding one step right and down for each value until either the bottom or right edge of the array is reached. For example, in the array represented below, the numbers in red make up the lead diagonal
Computers and Technology
1 answer:
saveliy_v [14]2 years ago
6 0

A 2d array (i.e. 2 dimensional array) represents its elements in rows and columns

<h3>The program in Java</h3>

The method in Java, where comments are used to explain each line is as follows

//This defines the method

public static int diagSum(int[][] myArray) {

    //This initializes sum to 0

    int sum = 0;

    //This iterates through each row of the array

               for (int i = 0; i < myArray.length; i++) {

                   //This calculates the sum of the diagonals

                       sum+=myArray[i][i];

               }

               //This returns the sum

               return sum;

       }

Read more about methods at:

brainly.com/question/15969952

You might be interested in
Transition words and phrase in a paragraph
balandron [24]

Answer:

Msms

Explanation:

8 0
3 years ago
Read 2 more answers
This exspansion slot essentially replaced PCI and AGP slots
MrRa [10]
PCI and AGP slots have been replaced with PCI-E slot (PCI-Express). There are different types of PCI-E buses:

PCI Express 1x (250 [500] * MB/s)
PCI Express 2x (500 [1000] * MB/s)
PCI Express 4x (1000 [2000] * MB/s)
PCI Express 8x (2000 [4000] * MB/s)
PCI Express 16x (4000 [8000] * MB/s)
<span>PCI Express 32x (8000 [16000] * MB/s)

I hope that's what you meant :)</span>
4 0
3 years ago
Assume there is a class AirConditioner that supports the following behaviors: turning the air conditioner on and off, and checki
vaieri [72.5K]

Answer:

yes?

Explanation:

8 0
3 years ago
Why are wiki's not secure​
Nookie1986 [14]
Wikipedia is not a reliable source for citations elsewhere on Wikipedia. Because, as a user-generated source, it can be edited by anyone at any time, any information it contains at a particular time could be vandalism
7 0
2 years ago
The main components of a computer ar a hardware and software b) disc and monitor c) system and unit d) communication devices. ​
yulyashka [42]
Option A is the main component
3 0
2 years ago
Other questions:
  • What is client server relationship is the basic form of what
    6·1 answer
  • Two electronics students are discussing electrical units. Student A says that electrical power is measured in units called coulo
    5·1 answer
  • How do you do this question?
    7·1 answer
  • What common communication devices are used in homes to connect to the internet and remote networks and what capabilities do thes
    10·1 answer
  • Which button, when pressed, allows light from the subject to fall on the sensor?
    8·1 answer
  • What lets you do many things, like write book reports and stories?
    5·1 answer
  • With the range E2:E30 selected, create a new conditional formatting rule that uses a formula to apply yellow fill and bold font
    10·1 answer
  • linela Insurance needs to hire twenty accountants immediately to support its accounts receivable process. The hiring and trainin
    10·1 answer
  • A carver begins work on the following block of granite that weighs 2700 g. What is the density of the granite?
    13·1 answer
  • Write code which takes a sentence as an input from the user and then prints the length of the first word in that sentence.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!