I have a class, PhoneBook ,that instantiates an array of PhoneEntry objects. In phonebook, my teacher wants me to alphabetize the names as they come in. For example, you enter Bobby, it goes into book[0], next you enter Annie, after you enter Annie, i need it check to see if it less than the last entered(Bobby), which it is, so then the elements in the array need to move down, and Annie is inserted at book[0], and Bobby is now at book[1], i have a lessThan method in PhoneEntry, that checks to see if it less. So in the insert method of class Phonebook, i'll say if(book[current].lessThan) then perform the operation to insert it alphabetically. Does that make sense... i can post the code i have if neccessary. Any help is greatly appreciated
2007-02-19
10:33:14
·
4 answers
·
asked by
Mike
1