Question: a program with a main() method that asks the user to input an integer array of 10 elements. Next, create three methods described below. From
a program with a main() method that asks the user to input an integer array of 10 elements. Next, create three methods described below. From inside your main() method, call each of the three methods described below and print out the results of the methods 2, 3, which return values.
-
printReverse() - a method that receives an array of integers, then reverses the elements of the array and prints out all the elements from inside the method. Print all in one line separated by commas (see sample output below).
-
getLargest() a method that receives an array of integers, then returns the largest integer value in the array. (print result from main() )
-
computeTwice() - a method that receives the previously reversed array of integers, then returns an array of integers which doubles the value of each number in the array (see the sample output below). (print result from main() )
Sample output:
Enter a number:
22
Enter a number:
34
Enter a number:
21
Enter a number:
35
Enter a number:
12
Enter a number:
4
Enter a number:
2
Enter a number:
3
Enter a number:
99
Enter a number:
81
Here the array in reverse: 81, 99, 3, 2, 4, 12, 35, 21, 34, 22
The highest valued element: 99
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
