Georgia State University
Department
of Computer Science
Fall 2008
Due October 13th,
2008 & September 14th, 2008.
Objectives:
To gain
experience with input/output in Java along with
Linked List.
You
are to write a program name phonedir that
maintains a list of records containing names and phone numbers. The
program
will prompt the user for a command, execute the command, then prompt
the user
for another command. The commands must be chosen from the following
possibilities:
a
Show all records
d
Delete the current record
f
Change the first name in the current record
l
Change the last name in the current record
n
Add a new record
p
Change the phone number in the current record
q
Quit
s
Select a record from the record list to become the current record
The
following example illustrates the behavior of each command (user input
is in bold)
c:\phonedir [enter]
A
Program to keep a Phone Directory:
a
Show all records
d
Delete the current record
f
Change the first name in the current record
l
Change the last name in the current record
n
Add a new record
p
Change the phone number in the current record
q
Quit
s
Select a record from the record list to become the current record
Enter
a command from the list above (q to quit):
f
d
Delete the current record
f
Change the first name in the current record
l
Change the last name in the current record
n
Add a new record
p
Change the phone number in the current record
q
Quit
s Select a record from the record list to become the current record
Enter a command from the list above (q to quit): nEnter
first name: Barry
Enter
last name: Drake
Enter
phone number: 770-591-8071
Current
record is: Barry Drake 770-591-8071
d
Delete the current record
f
Change the first name in the current record
l
Change the last name in the current record
n
Add a new record
p
Change the phone number in the current record
q
Quit
s Select a record from the record list to become the current record
Enter
a command from the list above (q to quit): n
Enter
last name: Caswell
Enter
phone number: 770-251-3456
Current record is: Ada Caswell 770-251-3456
MENU
DISPLAYED AGAIN
Enter
a command from the list above (q to quit): a
-------------
-------------
------------------
Ada
Caswell
770-251-3456
Barry
Drake
770-591-8071
Enter
a command from the list above (q to quit): n
Enter
first name: Elwood
Enter
last name: Havens
Enter
phone number: 404-345-8897
-------------
-------------
------------------
Ada
Caswell
770-251-3456
Barry
Drake
770-591-8071
Elwood
Havens
404-345-8897
Enter
new first name: Jake
Current record is: Jake Havens 404-345-8897
Enter
first name: Carl
Enter
last name: Patton
No
matching record found.
Enter
a command from the list above (q to quit): s
Enter
first name: Barry
Enter
last name: Drake
Deleted:
Barry Drake 770-591-8071
Enter
a command from the list above (q to quit): a
-------------
------------- ------------------
Ada
Caswell
770-251-3456
Elwood
Havens
404-345-8897
Enter
a command from the list above (q to quit): z
Enter
a command from the list above (q to quit): q
The
output of your program
must match the format illustrated in this example.
Here are some other additional requirements for this program:
Turn in a disk containing phonedir.java (or Main.java), phonedir.class (or phonedir.jar) and all other source files you used in your program your program. Also turn in listings (hard copies) of all source files. Please mark your name prominently on the disk and listings. You must put comments at the beginning of the program giving the program name, your name, the course number (CSC 3410) and the date as well as all documentations that we discussed in class.
NOTE: If you use CD, I may not be able to write the output file onto your disk, so I suggest that you either use a Floppy disk or a flash disk.