|
@@ -17,7 +17,6 @@
|
17
|
17
|
|
18
|
18
|
### Building a basic `PhoneBook` class
|
19
|
19
|
|
20
|
|
-<img src = "https://git.zipcode.rocks/Cohort4.2/CR-MicroLabs-Composition-PhoneBook/raw/branch/master/PhoneBookUML.png">
|
21
|
20
|
|
22
|
21
|
|
23
|
22
|
* Create a `PhoneBook` class that holds names and phone numbers.
|
|
@@ -27,17 +26,17 @@
|
27
|
26
|
|
28
|
27
|
* Your PhoneBook class should have the following method
|
29
|
28
|
|
30
|
|
-
|
|
29
|
+ * hasEntry(String name)
|
|
30
|
+ * given a name, return true if there is an entry with that name, false otherwise
|
31
|
31
|
* `add(String name, String phoneNumber)`
|
32
|
32
|
* adds an entry to the composite associate data type
|
33
|
|
- * `remove(String name)`
|
34
|
|
- * removes an entry to the composite associate data type
|
35
|
33
|
* `lookup(String name)`
|
36
|
34
|
* returns a phone number for the respective input `name`
|
37
|
|
-
|
|
35
|
+ * `remove(String name)`
|
|
36
|
+ * removes an entry to the composite associate data type
|
38
|
37
|
* `reverseLookup(String phoneNumber)`
|
39
|
38
|
* returns a name for the respective input `phoneNumber`
|
40
|
|
- * `toString()`
|
|
39
|
+ * `listNamesAndNumbers()`
|
41
|
40
|
* return a human-readable list of all entries (names and phone numbers) in alphabetical order.
|
42
|
41
|
* Format should be `[name] [phone number]`
|
43
|
42
|
|
|
@@ -48,7 +47,7 @@
|
48
|
47
|
PhoneBook phoneBook = new PhoneBook();
|
49
|
48
|
phoneBook.add("Zebra", "111-222-333");
|
50
|
49
|
phoneBook.add("Dog", "222-444-4444");
|
51
|
|
- phoneBook.display();
|
|
50
|
+ phoneBook.listNamesAndNumbers();
|
52
|
51
|
```
|
53
|
52
|
|
54
|
53
|
* Sample Output
|