Browse Source

Added Exceptions section to lab.

David Ginzberg 7 years ago
parent
commit
232c4d744f
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      README.md

+ 5
- 1
README.md View File

@@ -16,7 +16,7 @@ Your completed lab must be submitted via GitHub. Labs are not complete unless th
16 16
 
17 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 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).
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 and phone numbers).
20 20
 
21 21
 ### Part II:
22 22
 
@@ -25,3 +25,7 @@ Add a `reverseLookup()` method to PhoneBook. This method should allow you to loo
25 25
 ### Part III: 
26 26
 
27 27
 Some people have more than one phone number. Refactor your PhoneBook class to map names to lists of phone numbers. You should modify your add() and remove() methods to handle adding or removing individual numbers, and create a removeRecord method for removing an entire entry from your PhoneBook.
28
+
29
+### Exceptions:
30
+
31
+Update your Phonebook from parts 1-3. Any methods that accept a phone number should throw an InvalidPhoneNumberFormat exception if an invalid phone number format is used. At a minimum you must support phone numbers in `(###) ###-####` format; you may choose to support other formats but they must be documented. No method should add an invalid phone number to your phonebook. If either lookup method or the remove method is called with an argument that does not exist in the phonebook (either a phone number or a contact) then a RecordNotPresent exception should be thrown. There may be some methods that could throw more than one type of exception. Your tests should account for the possibility of exceptions and test for those exceptions that are expected.