Suppose we have a new student whose name is "mcDonald Jones".
Although we don't know exactly why the letter "m" is written in
lowercase, when we arrange the order of English names, our rule should
be case-insensitive. That is, both uppercase "M" and lowercase "m"
should be in front of "S".
Re-write the getName() method in the previous exercise
so that it will handle the sorting
rule. You don't have to modify anything in the main() function.
Everything is handled by the object itself. This is the advantage of
"encapsulation" in object-oriented programming.
To make strings case-insensitive, you may simply convert all
characters to uppercase by the method string.upper(), or to lowercase by
the method string.lower().
By the way, Chinese characters are ordered by the number of
strokes. Therefore, if we have another student 文天祥, you may see that
his position is before 柳宗元.
The output may look like
Julia Roberts
mcDonald Jones
Sandra Bullock
文天祥
柳宗元
蘇東坡