

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


CS 331 Project #5 Nov. 1, 2004
Due at start of class on Wednesday, Nov. 10, 2004 50 points.
Refer to Problem #5, page 496, Textbook.
Write a program that provides a ay for you to store and retrieve telephone number. Design a user interface that provides the following operations:
Add: Adds a person’s name and phone number to the phone book. Delete: Deletes a given person’s name and phone number from the phone book, given only the name. Find: Locates a person’s phone number, given only the person’s name. Change: Changes a person’s phone number, given the person’s name and new phone numbers. Quit: Quits the application, after first saving the phone book in a text file.
Design and implement the class Person (refer to page 455, textbook) which represents the name and phone number of a person. You will store instances of this class in the phone book.
Design and implement the class PhoneBook, which represents the phone book. The class should contain a binary search tree as a data member. This tree contains the people in the book.
Add methods that use a text file to save and restore the tree.
Design and implement the class PhoneMenu, which provides the program’s user interface.
Write a client program (P5xxx.java) which instantiates a PhoneMenu and then performs:
CS 331 Project #5 Nov. 1, 2004
Folder cs331P5 contains: TreeNode.class, KeyedItem.class, FullName.class, TreeException.class, BinaryTreeBasis.class, Person.class, BinarySearchTree.class, Node.class, QueueException.class, QueueInterface.class, QueueReferenceBased.class, TreeIterator.class and cs331Phones.dat.
The binary file cs331Phones.dat contains the instance of class BinarySearchTree of 766 names with their phone numbers stored in the structure of binary search tree.
In order to restore the BinarySearchTree instance saved in cs331Phones.dat, you must include the original classes, which are stored in the folder cs331Prj5, that were used to create the binary file for the instance.