Adding a Borrower

Adding a Borrower

Interface Definitions:

Inputs to module:

Inputs by user:

Outputs:

Data Abstractions:

LAST NAME is a variable length string.

MIDDLE NAME is a variable length string.

FIRST NAME is a variable length string.

ADDRESS is a variable length string.

CITY is a variable length string.

PROVINCE is a variable length string.

POSTAL_CODE is a variable length string.

PHONE is a variable length digit string.

IDENTIFICATION is a positive integer number.

ADDRESS2 is a variable length string.

CITY2 is a variable length string.

PROVINCE2 is a variable length string.

POSTAL_CODE2 is a variable length string.

PHONE2is a variable length digit string.

Design

Environment: GUI (graphical user interface)

Interface: Pop-up window.

Completion of this module is performed by:

  1. Pressing Cancel - in which case no addition is performed.
    • Add window is closed.
  2. Pressing Add - syntactical error checking is done.
    • Confirmation Window is popped up.

At Confirmation Window:

  1. Pressing Cancel - no Addition is performed.
    • Confirmation Window is closed.
  2. Pressing Add - Adds a new borrower.
    • Confirmation Window is closed.
    • Add borrower window is closed.
  3. Pressing Edit - No addition is performed.
    • Confirmation window is closed.
    • Add borrower window is back on and read for editing.
    • It will be possible for user to interrupt this module and do something else. BUT the system cannot close without explicitly completing this module.

Sub-Modules:

Error-Handling:

Syntactical Errors:

IF city entered does not match any city currently in system.

THEN give error window:

IF province entered does not match any province currently in system.

THEN give error window:

IF postal-code entered does not match any format currently in system.

THEN give error window:

IF phone number entered does not match any format currently in system.

THEN give error window:

IF ID matches an ID in the system other than the borrowers previous ID.

THEN give error window:

Empty-Field Errors:

IF ID field is left empty

THEN give error window:

For every other field:

IF field is left empty

THEN give error window:

Imports:

Exports:

Pseudocode/Visual Basic Code

bool add_borrower()
{
switch (button)
	{
	case button = cancell
		exit(0);
		break;
	case button = edit 
		back to window;
		break;
	case button = add
		output (" the following user will be added. Do you wish to
			 continue?"); 
			if (yes)
			then
			if (last == Null)
				output ("last name field is empty continue 
						anyway?");
					if yes continue;
					else back to window;
			if (first == Null)
				output ("first name field is empty continue 
						anyway?");
					if yes continue;
					else back to window;
			if (middle == Null)
				output ("middle name field is empty continue 
						anyway?");
					if yes continue;
					else back to window;
			if (city not in database)
				output ("This city is unknown is the spelling
					correct?");
					if yes continue;
					else back to window;
			if (prov/state not in database)
				output ("This provence or state is unknown 
					is the spelling correct?");
					if yes continue;
					else back to window;
			if (id# in database )
				ooutput (" This ID number is already in use.
					enter another?");
					if yes back to window;
					else cancel;
			if (id# == Null)
				output (" An ID number must be entered to add
					a borrower to database. Enter again?");
					if yes back to window;
					else cancel;
		break;
	}
open datastore borrower;
write new record to datastore;
close datastore borrower;
 
return (0);
}



Back to the Borrower Function Index