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
write a program which prompts the user for a celsius temperature, convert the temperature to fahrenheit, and print out the conve
JulsSmile [24]

print("——OR——") Input ("Temperature value in degree Celsius:"), celsius 2 = float) Celsius 2 = (Fahrenheit 2 * 9/5) + 32; print the result.

The user's input is taken. Enter the temperature in celsius by typing it into the input box. Fahrenheit is equivalent to (celsius multiplied by 1.8) + 32 print(str(celsius)+ "A degree in Celsius is equal to a " + str(fahrenheit)+ " degree in Fahrenheit. The change from C to F is therefore 100/180, or 5/9. It is 180/100 or 9/5 from F to C. As a result, the conversion yields °F = °C (9/5) + 32. As a result, the equation for changing from the Celsius to Fahrenheit scale becomes °F = °C (9/5) + 32. To convert from degrees Fahrenheit to degrees Celsius, do the inverse calculation: subtract 30 from the degrees Fahrenheit reading, then multiply the result by two to obtain the degrees Celsius reading.

Learn more about conversion here-

brainly.com/question/13163755

#SPJ4

6 0
8 months ago
In addition to MLA, what are some other widely used style guides? Check all that apply.
STALIN [3.7K]

Answer:

In addition to MLA, <u>American psychological association, Associated Press and Chicago manual of style</u> are widely using referencing techniques,

Explanation:

<u>American Psychological Association(APA)</u>

APA is the largest organization of scholars, they have their own referencing style guidelines that is used by these scholars.

<u>Associated Press</u>

It is also an american based agency that have their own referencing style for citation of research work named as Associated press.

<u>Chicago Manual of Style</u>

It is also an american referencing style used for reference.

8 0
2 years ago
which of the following peripheral does not belong to a group: A) Monitor B) Printer C) Hardware D) Keyboard​
nikdorinn [45]
C hardware is the correct answer
5 0
3 years ago
Submit your newsletter that includes the following: two or three columns a title at least three graphics, but not more than six
BigorU [14]

God Is Good He Will Always Help You He Is Good And Always Good!!

If God Is For Us Who Can Be Against us?? Romans 8:31

7 0
2 years ago
Read 2 more answers
Where are methods listed in a UML class diagram showing three parts?
denis23 [38]

Answer:

the bottom third

Explanation:

Check out the exampe below.

swim() would be an example of a method.

3 0
2 years ago
Other questions:
  • A(n ____ with a drop down menu provides consistency in function and appearance making it easy for users to learn and work with t
    7·1 answer
  • What executable programs have names that are just one character long, and what do they do??
    5·1 answer
  • How can you keep your files organized on your computer?
    13·2 answers
  • Are computer virus and human virus the same​
    6·1 answer
  • Does the brain play a role in smartphone addiction
    7·2 answers
  • Describe at least two other companies that are direct or indirect competitors to your company. Explain how you will differentiat
    15·1 answer
  • a publication usually issued daily,weekly or other regular times that provides news,views,features and other information of publ
    8·1 answer
  • You are between flights at the airport and you want to check your email. Your wireless settings show two options:
    14·1 answer
  • Explain software piracy and Hacking​
    13·2 answers
  • How do we store value in a variable? Give an example
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!