Homework 3 -
Write a Java application that allows a user to enter numbers into an array and then process them.
Enter the number of elements and the value of each element;
Your application will process the data entered and will display the results:
1. Display the elements of the array, max 10 per line
2. Find and display the max value and the index of this max;
3. Display the Even elements;
4. Sorts and displays the numbers from lowest to highest using Arrays.sort() method from java.util.Arrays class
It is recommended to design and implement the methods:
getMax - find the maximum element of the array;
getIndexOfMax - find the index of the maximum element (first if the are many);
displayEvens - find and display the even elements;
displayArray - display the elements of the array;
Example:
How many values you want to input:15
Enter number 0 :21
Enter number 1 :22
Enter number 2 :23
Enter number 3 :24
Enter number 4 :25
Enter number 5 :26
Enter number 6 :27
Enter number 7 :1
Enter number 8 :2
Enter number 9 :3
Enter number 10 :4
Enter number 11 :5
Enter number 12 :6
Enter number 13 :7
Enter number 14 :8
array:
21, 22, 23, 24, 25, 26, 27, 1, 2, 3,
4, 5, 6, 7, 8
Max value entered was 27 and has the index: 6
Evens entered:
22, 24, 26, 2, 4, 6, 8
Ascending Sorted Array is:
1, 2, 3, 4, 5, 6, 7, 8, 21, 22,
23, 24, 25, 26, 27