Advertisement
akosiraff

ArraySorter JAVA

Nov 11th, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1.  
  2. Download: http://solutionzip.com/downloads/arraysorter-java/
  3. Create a class called ArraySorter.java that contains the following methods:
  4. public static void bubbleSortIncrease(int[] anArray)
  5. public static String printArray(int[] anArray)
  6. The bubble sort algorithm examines all adjacent pairs of elements in the array from the beginning to the end and interchanges any two elements that are out of order. Each interchange makes the array more sorted than it was before and when the end of the array is reached it will be totally sorted.
  7. ( http://en.wikipedia.org/wiki/File:Bubble-sort-example-300px.gif )
  8. The printArray method will iterate through the array and concatenate each integer value to a String variable.
  9. Create and code your ArraySorter.java solution in Eclipse. Submit your solution and pseudo code.
  10. Program Requirements:
  11. 1. Name your classes as outlined above.
  12. 2. Follow Java naming conventions for all variables.
  13. 3. Use appropriate indentation for program.
  14. 4. Practice good commenting
  15. In your main() method you must instantiate, sort, and print the following two int arrays
  16. {4, 87, 14, 65, 56, 2, 352, 1, 0, 677, 221, 5}
  17. {90, 34, 4, 58, 91, 100, 655, 324, 111, 101, 76}
  18. Sample Output:
  19. Array One: {4, 87, 14, 65, 56, 2, 352, 1, 0, 677, 221, 5}
  20. Bubble Sorted Array One: {0, 1, 2, 4, 5, 14, 56, 65, 87, 221, 352, 677}
  21. Array Two: {90, 34, 4, 58, 91, 100, 655, 324, 111, 101, 76}
  22. Bubble Sorted Array Two: {4, 34, 58, 76, 90, 91, 100, 101, 111, 324, 655}
  23.  
  24. Download: http://solutionzip.com/downloads/arraysorter-java/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement