Write a class DormService that keeps track of service for everyone in
the dorm. It will use an array of StudentService objects to hold the
service information. It needs a number of public methods to fill and process
this array:
- void readServiceInfo() should read in all of the service
information, filling the array. Note that it will have to consolidate the
service hours for each student into a single entry, which means it will
have to search the array for
- void sortByName() should sort the array into alphabetical
order by student name.
- double lookupHours(String name) should take a name and return
the total number of hours for that student. You must use a binary search
for this lookup!
- String toString() should return a string representing the contents
of the array. The string should contain a series of lines, each containing
a name followed by the total number of hours for that student.
- int numAbove(int min) should return the number of students who
have at least min hours.
You will likely need other (private) methods as well.
Think carefully before writing
other public methods.
Your main program will be very simple. It just creates an instance of your
DormService class and calls the methods to read the information, sort the list,
print the list, the top server, and the number of T-shirt winners.
It then needs a little loop to
read names from the user and lookup the number of hours for each name
entered.