Question: Exercise 3 AddressBook again. Your task is to modify the classes that we have created in Lab 2 ( AddressBook exercise) and save it in
Exercise 3
AddressBook again. Your task is to modify the classes that we have created in Lab 2 ( AddressBook exercise) and save it in the same directory. This time, you have to implement the address book using a suitable class from the Java Collection framework. There is no size limitations for this new address book. In other words, the address book should be able to hold any number of address book entries. You public interface of the new address book class will mostly be the same, but the internal data structures should be different.
You should provide the following methods for the address book.
A. Add entry - will add a new address book entry to the address book. In this version, you need to add a new entry in ascending order. In other words, the address book should maintain an ordered list of address book entry based on the persons name.
B. Delete entry will take a name as parameter, find an entry that matches the name and will delete the entry from the address book. The method should return true if the deletion is successful, return false if the supplied name is not found in the address book
C. View all entries There should be two overloaded methods that will display the non-empty entries of the address book. Show (boolean ascending) this method should display all the non-empty address book entries in ascending order by persons name, if ascending is true, otherwise it should display all the non-empty address book entries in descending order by the persons name.
It should in display with their sequence number on the screen. For example:
1. Name: Alex Address: 123 abc St. Kamloops Tel: 123-234-2192 Email: alex@tru.ca
2. Name: Dan Address: 231 XYZ St. Kamloops Tel: 223-222-2234 Email: dan@tru.ca
D. Update an entry will take a name as parameter, find an entry that matches the name and will update a specified non-empty entry. For example, the following method should update the entry with name poly of the address book. A client may call this method as follows:
updateEntry(Poly, Moly, 123 McGill Rd. Kamloops, 123-435- 7532, moly@tru.cs);
E. Search an entry this will take a persons name as parameter and return an address book entry if a matching entry is found. You must use the binary search method from the Collections class to implement this method.
3. Finally create a test client called AddressBookTestClient in another separate file that will have the main method and test the functionality of the address book for all the method. Make sure you test all possible boundary conditions in many possible ways, and attack the screenshots of your test cases.
please give me the java code, thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
