Kristofer Younger dcb704db6a Update 'README.md' | 6 anni fa | |
---|---|---|
.gitignore | 6 anni fa | |
PhoneBook.java | 6 anni fa | |
PhoneBookTest.java | 6 anni fa | |
PhoneBookUML.png | 6 anni fa | |
README.TXT | 6 anni fa | |
README.md | 6 anni fa | |
package.bluej | 6 anni fa |
PhoneBook
class![PhoneBookDesign]("PhoneBookUML.png")
PhoneBook
class that holds names and phone numbers.Hint: You should use a sorted map.
Your PhoneBook class should have the following method
add(String name, String phoneNumber)
remove(String name)
lookup(String name)
name
reverseLookup(String phoneNumber)
phoneNumber
toString()
return a human-readable list of all entries (names and phone numbers) in alphabetical order.
Sample Script
PhoneBook phoneBook = new PhoneBook();
phoneBook.add("Zebra", "111-222-333");
phoneBook.add("Dog", "222-444-4444");
String entries = phoneBook.toString();
System.out.println(entries);
Dog 222-444-4444
Zebra 111-222-333
PhoneBook
class to map names to lists of phone numbers.add()
and remove()
methods to handle adding or removing individual numbersremoveRecord
method for removing an entire entry from your PhoneBook.