Build a simple PhoneBook program.
chu1ta26 e1ba262d58 Update 'README.md' 6 年前
.idea tring to merge 6 年前
src/test/java/com/zipcodewilmington/phonebook lab is done 6 年前
.gitignore port to BlueJ 6 年前
PhoneBook.java tring to merge 6 年前
PhoneBookTest.java port to BlueJ 6 年前
PhoneBookUML.png Add files via upload 6 年前
README.TXT port to BlueJ 6 年前
README.md Update 'README.md' 6 年前
package.bluej port to BlueJ 6 年前
phonebook.iml tring to merge 6 年前
pom.xml update pom file 6 年前

README.md

<<<<<<< HEAD

PhoneBook Lab:

======= *

PhoneBook Lab

d733dda8f1

Write the classes needed to implement a very simple PhoneBook.

  • Fork and clone this repository to complete your lab. Submit with a Pull Request.

Unit Tests

  • You are expected to write unit tests for your code.
  • You must have a Test class for every class you write.
  • 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 git pull request from your own fork.
  • 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

<<<<<<< HEAD

Building a basic PhoneBook class

=======

d733dda8f1 PhoneBookDesign

In this diagram, C stands for Class, f stands for field, and m stands for method. So, it can give you a specification for the class and the things it needs to do.

  • 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 from the java standard library.

  • 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
    • lookup(String name)
      • returns a phone number for the respective input name
    • remove(String name)
      • removes an entry to the composite associate data type
    • reverseLookup(String phoneNumber)
      • returns a name for the respective input phoneNumber <<<<<<< HEAD
    • listNamesAndNumbers()
      • return a human-readable list of all entries (names and phone numbers) in alphabetical order.
      • Format should be [name] [phone number]

=======

* `toString()`
    * return a human-readable list of all entries (names and phone numbers) in alphabetical order.

d733dda8f1

   * Sample Script

       ```java
       PhoneBook phoneBook = new PhoneBook();
       phoneBook.add("Zebra", "111-222-333");
       phoneBook.add("Dog", "222-444-4444");

<<<<<<< HEAD

       phoneBook.listNamesAndNumbers();

=======

       String entries = phoneBook.toString(); 
       System.out.println(entries);

d733dda8f1

       ```
   * Sample Output

       ```
        Dog 222-444-4444
        Zebra 111-222-333
       ```

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.