Revise SelectionSort.java listing 7.8, page 270, to sort a list of students name
ID: 3680972 • Letter: R
Question
Revise SelectionSort.java listing 7.8, page 270, to sort a list of students names (as strings) (name it SortStrings). Design the main method to prompt the user to enter the list size, read the student names into an array of strings, print the array before sorting (use the label “List Before Sorting:”), pass the array to the sort method, and finally print the sorted array in the main method (use the label “List After Sorting:”). No printing in the sort method. Design the main method of your program such that it allows the user to re-run the program with different sets of inputs (i.e., use a loop). Document your code, and organize and space the outputs properly. Use escape characters and formatting objects when applicable.
Explanation / Answer
Please find the required code and output below:
------------------------------------------------------------------
OUTPUT:
Enter list size :
5
Enter names
asdasd
qweqqw
asdww
saedw
zxcw
List Before Sorting:
asdasd
qweqqw
asdww
saedw
zxcw
List After Sorting:
asdasd
asdww
qweqqw
saedw
zxcw
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.