Java Sorting



Posted : 9 months ago

Write a program with the following class and functionality. class Assign3 (save as Assign3.java)

 

        main(..)

 

class Assign3 will contain the public static void main(..) method. It will contain an array of people’s names

 

        String names[] = {"Carol Danvers","halo JOnes", "lex LUthor", "NEal adams", "halo Jones","theo KOjak", "david starsky",

 

        "clark KEnt", "Carol Danvers","bruce LEE", "bruce WAYne","donald trump", "NEal adams", "DONAld TRump", "david starsky", "clark KEnt", "Bruce Lee",

 

        "bruce WAYne","xavier chuck", "donald trump","JAck Kirby","LOis LAne", "LAdy Penelope","DIana Prince","Carol Danvers","","","","",""};

 

        Note that the last couple of array slots are empty.

 

        main(..) will invoke the following methods (and please note, when you create these array methods, they should all work for any sized arrays.:

 

        sortArray(….) (instance method)

 

        Use this method to perform a bubble sort on the array in ascending alphabetical order (i.e. in name sequence). This method will take at least an array of String type as a parameter, HOWEVER remember that you cannot sort the entire array, as the last few array slots are empty. This method will return nothing. If you were to display the array after calling this method, it will look similar to this:

 

Find the attached file for more details.




Files Attached