Browse Source

myCode += moreCode

Amy Gill 6 years ago
parent
commit
b341f02751
1 changed files with 8 additions and 1 deletions
  1. 8
    1
      src/main/java/com/zipcodewilmington/phonebook/PhoneBook.java

+ 8
- 1
src/main/java/com/zipcodewilmington/phonebook/PhoneBook.java View File

@@ -47,7 +47,14 @@ public class PhoneBook {
47 47
 
48 48
     public String reverseLookup(String number) {
49 49
 
50
-        return
50
+        for (Map.Entry<String, Person> phoneBookEntry : personTreeMap.entrySet()){
51
+            if (phoneBookEntry.getValue().getNumbers().contains(number)){
52
+                String foundName = phoneBookEntry.getKey();
53
+                return foundName;
54
+            }
55
+        }
56
+
57
+        return "We're sorry. We could not find that number. Have a nice day.";
51 58
 
52 59
     }
53 60