![]() Your addPerson method won't add the Person if the list is empty, since while (0 < 0) will be false, and the loop won't be entered : int index = 0 * name in Last, First order followed by the phone number * in a formatted String (24 character name field, followed by the number) * accessor method to return the instance data of this Person Last = na.substring(na.indexOf(" ") + 1) Return name.toUpperCase().equals(()) & number.equals(oth.number) įirst = na.substring(na.indexOf(",") + 2) įirst = na.substring(0, na.indexOf(" ")) * true if names and numbers match, false otherwise * accessor method to test if the instance data for this Person * negative, zero, or positive int as per Comparable interface * and a negative number if this is less than oth * will return a positive number if this is greater than oth * based on the name field for this Person * accessor method that implements the Comparable interface * the new phone number for the individual * just in case somebody needs to enter witness protection * modifier method to set a new phone number this Person * The helper method convert() is called to handle the details * modifier method to set a new name for this Person * accessor method to return the phone number of this Person * the name of the individual in Last, First order * accessor method to return the name of this Person * copy constructor, will make an exact copy of the parameter * nu is the phone number of the individual * names, as well as the entire name in Last, First order * explicit constructor, will store the first and last * - the name of the person if the number was found, otherwise null. * number - name of individual to look up in the Directory. * will search the Directory to find out if the phone number * - the phone number if the name was found, otherwise null. * name - name of individual to look up in the Directory. * phone number associated with this person. * will search the Directory to find out if the name passed in * - true if the entry was successfully removed, otherwise false. * name - individual to be removed from the Directory. ![]() While(index Directory if the name parameter ![]() Public boolean addPerson(String name, String number) * - true if the entry was added successfully, otherwise false. * number - phone number of the individual to be added. * name - name of individual to be added to the Directory. * will display the entries currently entered in the Directory.įor(int i = 0 i Directory in alphabetical order * - the number of valid entries in the Directory. * will return the number of entries currently entered in Public class Phonebook implements Directory Im trying to make a PhoneBook using array list but I'm not getting the right output here is my code, thank you for any help with this, the output I'm getting now is just a zero when i ask for the size, not seeming to add anyone, that is probably where the problem lies import ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |