!We use Java sort the following items

profileTopsolutions
 (Not rated)
 (Not rated)
Chat

We use Java: sort the following items: Rocket J. Squirrel, Bullwinkle J. Moose, Boris Badenov, Natasha Fatale, Fearless Leader, Mr. Big, Cloyd, Gidney, Metal-Munching Moon Mice, Capt. Peter "Wrongway" Peachfuzz, Edgar, and Chauncy

Your program should perform the following tasks.

1. Read the data in from the keyboard into the array interactively.

2. Print the array.

3. Sort the array in ascending order using the bubble sort;

4. Print the array;

5. Sort the array in descending order using the bubble sort;

6. Print the array.

Further specification:

You must use a separate method for each task.
There must be a method for loading the data into the array.

There must be one and ONLY one method for printing the contents of the array.

There must be a method for sorting the array in ascending order.

There must be a method for sorting the array in descending order.

If you do not use the bubble sort in the methods which sort the data, do not bother handing your code in to me.

The list of names is long. Save yourself some aggravation with these two suggestions:
1. Use the nextLine() method to read the String data from the keyboard into the array.
2. Do NOT enter all the data each time you test. Start by entering only one character instead of
each full name. Enter all of the entire names when you are sure all of your sorting and printing
algorithms are running correctly.

 

    • 12 years ago
    complete solution
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      arraysort.java