CHU1TA26 1778fc8120 Merge branch 'master' of https://git.zipcode.rocks/chu1ta26/ZCW-PhoneBook | 6 年之前 | |
---|---|---|
.idea | 6 年之前 | |
src/test/java/com/zipcodewilmington/phonebook | 6 年之前 | |
.gitignore | 6 年之前 | |
PhoneBook.java | 6 年之前 | |
PhoneBookTest.java | 6 年之前 | |
PhoneBookUML.png | 6 年之前 | |
README.TXT | 6 年之前 | |
README.md | 6 年之前 | |
package.bluej | 6 年之前 | |
phonebook.iml | 6 年之前 | |
pom.xml | 6 年之前 |
<<<<<<< HEAD
======= *
Write the classes needed to implement a very simple PhoneBook.
PhoneBook
class<<<<<<< HEAD
PhoneBook
class=======
In this diagram, C stands for Class, f stands for field, and m stands for method. So, it can give you a specification for the class and the things it needs to do.
PhoneBook
class that holds names and phone numbers.Hint: You should use a sorted map from the java standard library.
Your PhoneBook class should have the following method
add(String name, String phoneNumber)
lookup(String name)
name
remove(String name)
reverseLookup(String phoneNumber)
phoneNumber
<<<<<<< HEADlistNamesAndNumbers()
[name] [phone number]
=======
* `toString()`
* return a human-readable list of all entries (names and phone numbers) in alphabetical order.
* Sample Script
```java
PhoneBook phoneBook = new PhoneBook();
phoneBook.add("Zebra", "111-222-333");
phoneBook.add("Dog", "222-444-4444");
<<<<<<< HEAD
phoneBook.listNamesAndNumbers();
=======
String entries = phoneBook.toString();
System.out.println(entries);
```
* Sample Output
```
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.