Question: Arrays & Algorithms Write a Java program that includes the following components: 1 ) Array Squaring Method: Create a static method named squareArray that accepts

Arrays & Algorithms
Write a Java program that includes the following components:
1) Array Squaring Method: Create a static method named squareArray that accepts a one-dimensional array of integers as an argument.
This method should return a new array containing the elements of
the input array squared while leaving the original input array
unchanged.
For example, if the input array is 5,8,2,7,20,9 the method should
return a new array 25,64,4,49,400,81.
2) Main Method:
In the main method, perform the following steps:
1.Prompt the user to enter a series of numbers separated by
commas (no spaces). An example of a valid input: 7,9,20,18,5,6
2.Tokenize the input and store it into an array of integers.
3.Call the squareArray method with the array from above and
store the result.
4.Output the elements of the array returned by squareArray,
displaying one element per line.
5.Find the sum of the squared array and output the results to the
system console.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!