A+ Work



Write a console program that repeatedly prompts the user to enter data until they type done (any case, Upper, Lower, or Mixed). As they enter the data, assign it to a two-dimension array where the first dimension contains exactly what they type and the second dimension contains the first non-whitespace character of what they type, in lowercase. If they enter a blank line, it is acceptable to skip that line. When they type done, do these steps:

display: As Entered

for each entry in the array, display the index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated by : (colon).

display: Bubble Sorted

using a bubble sort, for each entry in the array, display the original index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated by : (colon) sorted by the second dimension.

display: Selection Sorted

using a selection sort, for each entry in the array, display the original index of the first dimension, the second dimension's value, and the first dimension's value on a single line separated by : (colon) sorted by the first dimension. 



Grading Notes:



Please read the instructions carefully! Using the wrong sort or dimension will hurt your grade!

The instructor will attempt to crash your program -- an exception will cost you 10 points -- don't let exceptions happen!

If you ensure that duplicate values are sorted with the lower original array index first, you will get 5 extra points (final score not over 100).

You can use the sort methods from the book, but you will get 5 extra points if you do them as inner classes and FULLY comment them.





Example:



User types:

apple

Apple

Zone

apple

done