In the last assignment, we created a class called Name
.
This time, we are going to add the following methods:
toString
, which returns a String
consisting of the name.Name
precedes
, which returns true if the objectr
comes before the parameterCreate a main program that reads in three names and prints the name that is first in standard alphabetical order (by last name; if the last name is the same by first name; if both match by initial).
Extra credit: Create a program that reads in three names and prints them in the order in which they should appear. Hint: Write a method that takes all three names and returns the name that appears first, a method that takes all three names and returns the name that appears in last.
The previous assignment can be found in Assignment #9