CSC 3410 Programming Assignment #4

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment

Description

5/5 - (8 votes)

Objectives:

To gain experience with Java’s Linked List.

Documentation:

  1. Explain the purpose of the program as detail as possible – 10%.
  2. Develop a solution for the problem and mention algorithms to be used –10%
  3. List data structures to be used in solution. – 5%.
  4. Give a description of how to use the program and expected input/output – 5%
  5. Explain the purpose of each class you develop in the program. – 5%.

Programming:

  1. For each method, give the pre and post conditions and invariant, if any – 10%
  2. Program execution according to the requirements given 45%
  3. Naming of program as required 5%
  4. Print out of source code 5%

Description of Program

You are to write a program name Bank.java that maintains a list of records containing names and balance of customers. 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

          r     Remove 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

          d    Add a deposit to the current record

         w     Make a withdrawal from 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:\java Bank [enter]
A Program to keep a Bank Record:

    a     Show all records

   r     Remove 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

   d    Add a deposit to the current record

   w     Make a withdrawal from 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):   a

No records exist!!

    a     Show all records

   r     Remove 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

   d    Add a deposit to the current record

   w    Make a withdrawal from 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 the balance amount: 1000

Current record is: Barry Drake $1000.00

    a     Show all records

   r     Remove 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

   d    Add a deposit to the current record

   w    Make a withdrawal from the current record

    q Quit

    s   Select a record from the record list to become the new current record

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

MENU DISPLAYED AGAIN

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

 Enter first name: Ada

Enter last name: Caswell

Current record is: Ada Caswell

MENU DISPLAYED AGAIN

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

 

First Name                Last Name                     Current balance

————-                 ————-                          ——————

Ada                           Caswell                           $0.00

Barry                         Drake                              $1000.00

 

MENU DISPLAYED AGAIN

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

Enter first name: Elwood

Enter last name: Havens

Current record is: Elwood Havens

MENU DISPLAYED AGAIN

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

First Name                Last Name                      Current Balance

————-                ————-                      ——————

Ada                           Caswell                           $0.00

Barry                         Drake                              $1000.00

Elwood                      Havens                            $0.00


MENU DISPLAYED AGAIN

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

Enter new first name: Jake

Current record is: Jake Havens

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

MENU DISPLAYED AGAIN

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

Deleted: Barry Drake

MENU DISPLAYED AGAIN

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

First Name                Last Name                      Current Balance

————-                ————-                      ——————

Ada                           Caswell                           $0.00

Elwood                      Havens                            $0.00

MENU DISPLAYED AGAIN

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

Enter first name: Ada

Enter last name: Caswell

Current record is: Ada Caswell

MENU DISPLAYED AGAIN

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

Enter the deposited amount: 1000.00

Current record is: Ada Caswell with 1000.00 added to deposit

 

MENU DISPLAYED AGAIN

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

First Name                Last Name                      Current Balance

————-                ————-                      ——————

Ada                           Caswell                           $1000.00

Elwood                      Havens                            $0.00

MENU DISPLAYED AGAIN

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:

  • After a deletion, there is no record currently selected
  • Each record (first name, last name and balance) must be stored as an object. These objects must be stored in a Linked List.
  • The Linked List must be kept sorted at all times based on last name. Sorting is to be achieved when an insertion or modification is done. NO SORTING ROUTINE IS ALLOWED. ALWAYS INSERT A NEW RECORD OR EDITED RECORD INTO ITS’ CORRECT PLACE IN THE LINKED LIST. Note: Changing the last name will require resorting.
  • Use as many generic algorithm as you can.

What to turn in:

 

  1. All of the .java and the .class/jar files at the D2L website in the Dropbox folder for A4 no later than 11:00 p.m. on the respective due date.
  2. A print out of each of .java files to be given to the TA in LAB during next week. NOTE: Print out what you have already up the LAB time even if you are not finished.