-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTextDescription.txt
More file actions
14 lines (14 loc) · 950 Bytes
/
Copy pathTextDescription.txt
File metadata and controls
14 lines (14 loc) · 950 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
Create a program using arrays that sorts a list of integers in descending order.
Descending order is highest value to lowest.
In other words if the array had the values in it [106, 26, 81, 5, 15] your program
should ultimately have an array with [106, 81, 26, 15, 5] in it.
Set up the pro so that the numbers to sort are read in from the keyboard (Scanner).
Implement the following methods:
1) getIntegers has one parameter of type int which is the size of the array. It returns an array of entered integers from the keyboard.
2) printArray accepts an array and prints out the contents of the array. It should be printed in the following format:
Element 0 contents 106
Element 1 contents 81
Element 2 contents 26
Element 3 contents 15
Element 4 contents 5
3) sortIntegers accepts the unsorted array. It should sort the array and return a new array containing the sorted numbers.