Language:EN
Pages: 5
Words: 1048
Rating : ⭐⭐⭐⭐⭐
Price: $10.99
Page 1 Preview
test and document adequately the phonebook applica

Test and document adequately the phonebook application

Introduction

For this assignment, you are required to produce a Java simulation of a mobile telephone’s phonebook. The supplied Java interface class (Appendix: PhoneBook.java) shows the suggested contract between the class implementing the interface and any client classes. This interface must be used unmodified; however the class that implements it may provide additional methods. Your design should satisfy the following requirements.

- removeEntry(name) finds and removes the entry for that name (if any)

Further functionality is achieved by using ListIterator objects, which provide the methods next(),hasNext(), previous(), hasPrevious(), set(object), add(object), and remove(). Note that when iterating through the phonebook, entries should be retrieved in alphabetical order, and displayed in the form “name..number”.

2. Locate an entry

3. Remove an entry

The Browse submenu tests iterator methods, and could look something like this:

0. Return

5. Remove

6. Edit...

1. An Entry class that implements Comparable represents phonebook entry. In addition to the methods that you think are necessary, the class should have:

i) a constructor method Entry(String name, String number) to initialize the attributes name,

iv) toString() method to return a string of the form “name..number”.

2. A MyPhoneBook class implements the PhoneBook interface. The implementation should comply with the interface specification however you may provide addition methods. (Hint – as the menu options indicate) You should use ArrayList or LinkedList. If you write your own search or sort algorithm then this should be documented in pseudocode. Obviously, by using the “right” library classes you will have much less work to do.

6. a PhoneBkPro class that defines one method only – the main() method, which should be very short, say two lines only, to run the application interactively.

Submission

Appendix: Listing of the PhoneBook interface

/**

*/

public interface PhoneBook

* @param name the person's name to add

* @param number that person's phone number

* Given a name, retrieve the phonebook entry as a string

* (or return null if there is no matching entry)

/**

* Remove the phonebook entry matching a given name

/**

* Retrieve the number corresponding to a given name

/**

* Get current size of phonebook (number of entries)

* Check if phonebook is empty

* @return true if empty, else false

* @return true if full, else false

*/

public void clear();

/**

public java.util.ListIterator iterator();

/**

public String toString();

}

You are viewing 1/3rd of the document.Purchase the document to get full access instantly

Immediately available after payment
Both online and downloadable
No strings attached
How It Works
Login account
Login Your Account
Place in cart
Add to Cart
send in the money
Make payment
Document download
Download File
img

Uploaded by : James Mccoy

PageId: DOCA3446E6