소스 검색

Update README.md

Nhu Nguyen 6 년 전
부모
커밋
78f21155b7
No account linked to committer's email
1개의 변경된 파일15개의 추가작업 그리고 1개의 파일을 삭제
  1. 15
    1
      README.md

+ 15
- 1
README.md 파일 보기

@@ -14,7 +14,7 @@ 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. You can use an associative data type (one which stores items as keys paired with values).
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 20
   * lookup(String name) -  allows you to look up a person's phone number based on their name
@@ -22,6 +22,20 @@ Your PhoneBook class should have the following method
22 22
   * remove(String name) - remove entry
23 23
   * display() - list all entries (names an phone numbers) in alphabetical order
24 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
+    ```
38
+
25 39
 ### Part II:
26 40
 
27 41
 Add a `reverseLookup()` method to PhoneBook. This method should allow you to look up names by the phone number associated with them.