Last-minute modification, May 7 (I told you I was going to change the assignment at the last minute): each entry in the phone book comprises a name, telephone number, and one-line address. The user should still be able to search by name and get back both the phone number and address corresponding to that name; searching by phone number or address is extra credit.
Before you start, fill out a "Project Plan" in PSP with estimates of how long the program will be, how many defects you'll encounter, and how long it'll take you. (You will not be graded on how accurate your estimates are, but you are expected to make some kind of reasonable estimate.)
As you work on the assignment, keep track of all the defects you encounter, and your time use, using the PSP forms (click on "Input" under "Defect Removal Data" or "Time Management Data" respectively).
Write an applet to manage a personal phone book. Each
entry in the phone book comprises a name and a telephone number. Your
applet should have two TextFields, appropriately labelled, for "name"
and "telephone number", as well as three buttons labelled "add",
"search", and "delete".
When the "add" button is pressed, the name and
number currently in the TextFields are put into a new phone book
entry, which is added to the phone book.
When the "search" button is
pressed, the program searches the phone book for a match for the
specified name, and if it finds that name, fills in the phone number
TextField from the phone book. (If it doesn't find that name, it
should give an appropriate error message, either in the phone-number
TextField or in a separate Label used only for error messages.)
When the "delete" button is pressed, the program searches the address
book for a match for the specified name, and if it finds that name,
removes its entry from the phone book.
You may implement this in a number of different ways: you may use an
ArrayList or LinkedList, or your own List class, or (for extra
credit) implement a binary search tree. If you use some kind
of List, I'll expect you to implement a binary search, but you can use
a sequential search in an early version of the program.
As always, remember to write down the contract of each of these methods, and several examples of its use with correct answers, before writing any code for the method itself. And as always, design your program for modifiability and re-usability; I changed the assignment slightly the day before it was due.
Hints: You've already done a good deal of this stuff in homework 5, so you might want to use your homework 5 as a starting point; take out the Canvas, Balls, Boxes, and Shapes, change the names of the buttons and TextFields, and add a PhoneBookEntry class and a PhoneBook class. Most of the real work is in the PhoneBook class.
How to turn this in: Once you've got all of this working, "WinZip" the entire folder into a single file and send me an e-mail, attaching this ZIP file. If you have any comments about problems you encountered in writing the program, or things you learned, put these in the body of the e-mail.