|Why should the alphabetic ordering of names put so much emphasis on the first
letter in each name? In the spirit of fairness to all the letters in a name,
let's compute the average alphabetical position
of the letters in each name, and order the names accordingly.
We can define the "value" of a name to be the average position of the letters
in that name, counting an 'A' as 1, 'B' as 2, and so on up to 'Z' as 26. So, for example, the
value of "BOB" would be (2+15+2)/3 = 6.3333. When given a list of names, we
will order them by putting them in order of increasing value. When 2 or more names have
exactly the same value, we will break the tie by placing the names that were
earlier on the original list earlier on the ordered list.
Create a class Fairness that contains a method fairSort that is given a
String names and that returns a String
containing the same names sorted according to the above method. The elements in the
return should, of course, not contain any leading or trailing spaces.