|
@@ -17,24 +17,27 @@ Your completed lab must be submitted via GitHub. Labs are not complete unless th
|
17
|
17
|
Create a PhoneBook class that holds names and phone numbers. You can use an associative data type (one which stores items as keys paired with values). (Hint: You should use a sorted map).
|
18
|
18
|
|
19
|
19
|
Your PhoneBook class should have the following method
|
20
|
|
- * lookup(String name) - allows you to look up a person's phone number based on their name
|
21
|
|
- * add(String name, String phoneNumber) - add entry
|
22
|
|
- * remove(String name) - remove entry
|
23
|
|
- * display() - list all entries (names an phone numbers) in alphabetical order
|
24
|
|
-
|
25
|
|
- ```java
|
26
|
|
- PhoneBook phoneBook = new PhoneBook();
|
27
|
|
- phoneBook.add("Zebra", "111-222-333");
|
28
|
|
- phoneBook.add("Dog", "222-444-4444");
|
29
|
|
- phoneBook.display();
|
|
20
|
+ * lookup(String name) - allows you to look up a person's phone number based on their name
|
|
21
|
+ * add(String name, String phoneNumber) - add entry
|
|
22
|
+ * remove(String name) - remove entry
|
|
23
|
+ * display() - list all entries (names an phone numbers) in alphabetical order
|
|
24
|
+
|
|
25
|
+ * Sample Script
|
|
26
|
+
|
|
27
|
+ ```java
|
|
28
|
+PhoneBook phoneBook = new PhoneBook();
|
|
29
|
+phoneBook.add("Zebra", "111-222-333");
|
|
30
|
+phoneBook.add("Dog", "222-444-4444");
|
|
31
|
+phoneBook.display();
|
|
32
|
+ ```
|
|
33
|
+
|
|
34
|
+ * Sample Output
|
|
35
|
+
|
|
36
|
+ ```
|
|
37
|
+Dog 222-444-4444
|
|
38
|
+Zebra 111-222-333
|
|
39
|
+ ```
|
30
|
40
|
|
31
|
|
- /*
|
32
|
|
- Calling display this should print out the entries like this
|
33
|
|
- Dog 222-444-4444
|
34
|
|
- Zebra 111-222-333
|
35
|
|
- */
|
36
|
|
-
|
37
|
|
- ```
|
38
|
41
|
|
39
|
42
|
### Part II:
|
40
|
43
|
|