|
@@ -26,6 +26,7 @@
|
26
|
26
|
|
27
|
27
|
* Your PhoneBook class should have the following method
|
28
|
28
|
|
|
29
|
+
|
29
|
30
|
* `add(String name, String phoneNumber)`
|
30
|
31
|
* adds an entry to the composite associate data type
|
31
|
32
|
* `remove(String name)`
|
|
@@ -35,25 +36,27 @@
|
35
|
36
|
|
36
|
37
|
* `reverseLookup(String phoneNumber)`
|
37
|
38
|
* returns a name for the respective input `phoneNumber`
|
38
|
|
- * `display()`
|
39
|
|
- * print a human-readable list of all entries (names and phone numbers) in alphabetical order.
|
|
39
|
+ * `toString()`
|
|
40
|
+ * return a human-readable list of all entries (names and phone numbers) in alphabetical order.
|
|
41
|
+ * Format should be `[name] [phone number]`
|
|
42
|
+
|
40
|
43
|
|
41
|
44
|
* Sample Script
|
42
|
|
-
|
|
45
|
+
|
43
|
46
|
```java
|
44
|
47
|
PhoneBook phoneBook = new PhoneBook();
|
45
|
48
|
phoneBook.add("Zebra", "111-222-333");
|
46
|
49
|
phoneBook.add("Dog", "222-444-4444");
|
47
|
|
- phoneBook.display();
|
|
50
|
+ phoneBook.display();
|
48
|
51
|
```
|
49
|
|
-
|
|
52
|
+
|
50
|
53
|
* Sample Output
|
51
|
|
-
|
|
54
|
+
|
52
|
55
|
```
|
53
|
56
|
Dog 222-444-4444
|
54
|
57
|
Zebra 111-222-333
|
55
|
58
|
```
|
56
|
|
-
|
|
59
|
+
|
57
|
60
|
|
58
|
61
|
### Implementing Many-PhoneNumbers-To-One-Person Relationship
|
59
|
62
|
|