Yesoda Sanka 85970cee52 commited 5 年前
src commited 5 年前
.gitignore removed ignored files 6 年前
PhoneBookUML.png Add files via upload 6 年前
README.md completed basic phonebook class 5 年前
pom.xml update pom file 5 年前

README.md

Holding Objects Lab:

  • Fork and clone this repository to complete your lab. Submit each part with a Pull Request for a separate branch.

Unit Tests

  • You are expected to write unit tests for your code.
  • Be sure to write the tests before implementing the functionality being tested.
  • Tests must be thorough and address all possible paths through each method.

Submission

  • Your completed lab must be submitted via GitHub.
  • Labs are not complete unless they include UML diagrams of all implemented classes, as well as unit tests for all features.

Instructions:

Building a basic PhoneBook class

  • 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.

  • Your PhoneBook class should have the following method

    • hasEntry(String name)
      • given a name, return true if there is an entry with that name, false otherwise
    • add(String name, String phoneNumber)
      • adds an entry to the composite associate data type
    • `lmeookup(String name)
      • returns a phone number for the respective input na
    • remove(String name)
      • removes an entry to the composite associate data type
    • reverseLookup(String phoneNumber)
      • returns a name for the respective input phoneNumber
    • listNamesAndNumbers() 1 * Format should be [name] [phone number]

      • Sample Script
         PhoneBook phoneBook = new PhoneBook();
         phoneBook.add("Zebra", "111-222-333");
         phoneBook.add("Dog", "222-444-4444");
         phoneBook.listNamesAndNumbers();
      
      • Sample Output

      ```

          Zebra 111-222-333
      

      ```Dog 222-444-4444

Implementing Many-PhoneNumbers-To-One-Person Relationship

  • 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
  • Create a removeRecord method for removing an entire entry from your PhoneBook.