Bläddra i källkod

Merge pull request #85 from nhu313/patch-1

Update README.md
Git-Leon 6 år sedan
förälder
incheckning
d2dcd4f99a
No account linked to committer's email
1 ändrade filer med 21 tillägg och 3 borttagningar
  1. 21
    3
      README.md

+ 21
- 3
README.md Visa fil

@@ -14,9 +14,27 @@ Your completed lab must be submitted via GitHub. Labs are not complete unless th
14 14
 
15 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 39
 ### Part II:
22 40