Write a method named getSquares which takes an integer array and returns a new integer array of the same le input array. For example, if the input array is {2, 4, 5} the output would be {4, 16, 25)....


Please don't change anything. Put your code in line 7, 11 and 13.


Write a method namedgetSquares which takes an integer array and returns a new integer array of the same length where each element is the square of the corresponding element in the input array. For example, if the input array is {2, 4, 5} the output would be {4, 16, 25}.


Write a method named getSquares which takes an integer array and returns a new integer array of the same le<br>input array. For example, if the input array is {2, 4, 5} the output would be {4, 16, 25).<br>For full credit, your method must leave the input array unmodified.<br>I Full Screen ¢<br>alassJava Θ<br>1- import acm.program.CommandLineProgram;<br>2 import java.util.Arrays;<br>New<br>4- public class Class1 extends CommandLineProgram {<br>public void run() {<br>// Optionally put code here if you want to see terminal output.<br>}<br>6-<br>10<br>// DEFINE YOUR METHOD HERE.<br>public int[] getSquares(int[] input) {<br>// your code here<br>}<br>11<br>12-<br>13<br>14<br>15<br>16 }<br>

Extracted text: Write a method named getSquares which takes an integer array and returns a new integer array of the same le input array. For example, if the input array is {2, 4, 5} the output would be {4, 16, 25). For full credit, your method must leave the input array unmodified. I Full Screen ¢ alassJava Θ 1- import acm.program.CommandLineProgram; 2 import java.util.Arrays; New 4- public class Class1 extends CommandLineProgram { public void run() { // Optionally put code here if you want to see terminal output. } 6- 10 // DEFINE YOUR METHOD HERE. public int[] getSquares(int[] input) { // your code here } 11 12- 13 14 15 16 }

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here