Java Code Help! I need this code: http://ideone.com/VXYhO6 to do this: User type
ID: 3572199 • Letter: J
Question
Java Code Help! I need this code: http://ideone.com/VXYhO6
to do this:
User types:
You display:
The code for the bubble and selection sorted isnt working for me correctly and isnt listing the data in the proper order like the example above.
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:BubbleSorted
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:SelectionSorted
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.
Explanation / Answer
Please find the required program along with its output. Please see the comments against each line to understand the step.
--------------------------------------
OUTPUT:
Enter elements of your choice:
apple
Apple
Zone
apple
done
0:a:apple
1:a:Apple
2:z:Zone
3:a:apple
Bubble Sort
0:a:apple
1:a:Apple
3:a:apple
2:z:Zone
Selection Sort
1:a:Apple
0:a:apple
3:a:apple
2:z:Zone
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.