Browse Source

Merge pull request #85 from nhu313/patch-1

Update README.md
Git-Leon 6 years ago
parent
commit
d2dcd4f99a
No account linked to committer's email
1 changed files with 21 additions and 3 deletions
  1. 21
    3
      README.md

+ 21
- 3
README.md View File

14
 
14
 
15
 ### Part I:
15
 ### Part I:
16
 
16
 
17
-Create a PhoneBook class that holds names and phone numbers in sorted order. You can use an associative data type (one which stores items as keys paired with values).
18
-
19
-Your PhoneBook class should have a lookup() method which allows you to look up a person's phone number based on their name. PhoneBook should also have methods to add and remove entries, or to list all names or all entries (names an phone numbers).
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
+
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(); 
30
+      
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
+    ```
20
 
38
 
21
 ### Part II:
39
 ### Part II:
22
 
40