Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the one line of code to invoke the increase method inside main. Do you nee

ID: 3706764 • Letter: W

Question

Write the one line of code to invoke the increase method inside main. Do you need to receive the return value of increase with a local variable, why or why not?

Also, Write the one line of code to invoke the sum method inside main, and receive the return value with a local variable. What type should this local variable be? Then use a second line of code to output the return value to the console. Assume the actual parameter (the double type two-dimensional array) you plug in for method increase has been initialized.

Explanation / Answer

Write the one line of code to invoke the increase method inside main. Do you need to receive the return value of increase with a local variable, why or why not?

Answer:

Yes, we need to receive the return value of increase with a local variable.

Because, In java, If we change the variable value in method that value won't reflect in the calling method. We have to return the changed value to the calling function.

Code: n = increase(n);

[This is a java code]

---------------------------------------------------------------------------------------------------------------

Also, Write the one line of code to invoke the sum method inside main, and receive the return value with a local variable. What type should this local variable be? Then use a second line of code to output the return value to the console. Assume the actual parameter (the double type two-dimensional array) you plug in for method increase has been initialized.

Answer:

What type should this local variable be?

Answer: double

Code:

double sum = getSum(arr);

[This is a java code]