Georgia State University

Department of Computer Science

CSC 3410                         J. L. Bhola

Fall  2008

Programming Assignment #3

Due October 13th, 2008 & September 14th, 2008.

 

Objectives:

To gain experience with input/output in Java along with Linked List.

Description of Program

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

No current record

           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): n

Enter first name: Barry

Enter last name: Drake

Enter phone number: 770-591-8071

Current record is: Barry Drake 770-591-8071

           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): n

Enter first name: Ada

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

 

First Name                Last Name                      Phone Number

-------------                -------------                      ------------------

Ada                           Caswell                           770-251-3456

Barry                         Drake                              770-591-8071 

 

MENU DISPLAYED AGAIN


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

<>Current record is: Elwood Havens 404-345-8897


MENU DISPLAYED AGAIN

 Enter a command from the list above (q to quit): a

First Name                Last Name                      Phone Number

-------------                -------------                      ------------------

Ada                           Caswell                           770-251-3456

Barry                         Drake                              770-591-8071 

Elwood                      Havens                            404-345-8897


MENU DISPLAYED AGAIN
<> 

Enter a command from the list above (q to quit): f

Enter new first name: Jake

  Current record is: Jake Havens 404-345-8897

MENU DISPLAYED AGAIN

Enter a command from the list above (q to quit): s

Enter first name: Carl

Enter last name: Patton

 

No matching record found.
 

MENU DISPLAYED AGAIN

Enter a command from the list above (q to quit): s

Enter first name: Barry

Enter last name: Drake

<>  Current record is: Barry Drake 770-591-8071

MENU DISPLAYED AGAIN

Enter a command from the list above (q to quit): d

Deleted: Barry Drake 770-591-8071

MENU DISPLAYED AGAIN

Enter a command from the list above (q to quit): a
 

First Name                Last Name                      Phone Number

-------------                -------------                      ------------------

Ada                           Caswell                           770-251-3456

Elwood                      Havens                            404-345-8897

 

MENU DISPLAYED AGAIN

Enter a command from the list above (q to quit): z

Illegal command

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:

What to turn in

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.