Automated Teller System


Pseudocode

The pseudocode below consists of a starting procedure called Main and three sub-procedures called CheckPIN, Services and Withdrawal. The code is estimated to cover approximately 75% to 80% of the final system structure. The remaining parts of the system, such as the interrupt handling for special situations and the various hardware interaction processes, are dependant on the specifications of the actual hardware used to construct the machine.


figure 1: Procedural structure of the pseudocode


Main

The Main procedure is called when the system is started. It consists of a loop which repeats until the system is switched off. The loop first checks the Control System to see if it is enabled. If not, an 'out of service' message is displayed and the system then waits for the Control System to be enabled. If the Control System is enabled, the Card Reader is checked to see whether a card has been inserted. If not, an 'insert card' message is displayed. This message could include one of several informative messages or displays shown in rotation. If a card is detected in the Card Reader, the CheckPIN procedure is called.

PROCEDURE Main
BEGIN
    LOOP
        IF control system is disabled
            THEN BEGIN
                display 'out of service' message
                LOOP UNTIL control system is enabled
            END
            ELSE IF no card is inserted
                THEN display 'insert card' message
                ELSE CALL PROCEDURE CheckPIN
            ENDIF
        ENDIF
    ENDLOOP
END Main

CheckPIN

The CheckPIN procedure handles the verification of the customer's Personal Identification Number (PIN) using data retrieved from the card's magnetic strip. The procedure invites the customer to enter their PIN using the keypad. If this does not match the PIN stored on the card, a limited number of retries is permitted, after which the card is confiscated as a security precaution. If the correct PIN is entered, the Services procedure is called.

PROCEDURE CheckPIN
CONSTANTS
    MAXPINS IS 3
VARIABLES
    PINCounter IS NUMBER
BEGIN
    read data from card
    set PINCounter to zero
    LOOP UNTIL PINCounter is equal to MAXPINS
        input PIN from customer keypad
        IF entered PIN matches card PIN
            THEN EXITLOOP
        ENDIF
        add 1 to PINCounter
    ENDLOOP
    IF PINCounter is equal to MAXPINS
        THEN confiscate customer's card
        ELSE CALL PROCEDURE Services
    ENDIF
END CheckPIN

Services

The Services procedure presents a menu of the options which are currently available to customers. The customer selects an option by pressing a key on the keypad. The key is identified and the relevant option is activated. After processing an option the procedure will do one of two things. If a 'Withdrawal...' or 'Return Card' option was selected, the procedure will terminate. If any one of the other options were selected, the selection process is repeated to allow the customer to use another service. The options which request a cash withdrawal call the Withdrawal procedure.

PROCEDURE Services
VARIABLES
    ExitServicesFlag IS BOOLEAN
BEGIN
    RESET ExitServicesFlag
    LOOP UNTIL ExitServicesFlag is SET
        display customer services
        input selection from keypad
        CASE OF selection:
            WHEN withdrawal with receipt
            BEGIN
                CALL PROCEDURE Withdrawal (with_receipt)
                SET ExitServicesFlag
            END
            WHEN withdrawal without receipt
            BEGIN
                CALL PROCEDURE Withdrawal (no_receipt)
                SET ExitServicesFlag
            END
            WHEN display balance
                get and display balance
            WHEN print balance
                get and print balance
            WHEN order statement
                send statement order to control system
            WHEN order chequebook
                send chequebook order to control system
            DEFAULT
                return customer's card
                SET ExitServicesFlag
        ENDCASE
    ENDLOOP
END Services

Withdrawal

The Withdrawal procedure handles the process of withdrawing cash from the customer's account. It receives one parameter which indicates the type of withdrawal (ie. with or without a printed receipt). The customer is first presented with a list of cash values to select from and an option to enter their own value explicitly. Once a value has been specified, the customer's account details are checked in the Accounts Database. If there are no funds available, the customer is informed, the card is returned and the procedure terminates. If the customer has insufficient funds to cover the requested amount, the actual amount available is offered. If this reduced offer is declined, the customer's card is returned and the procedure terminates. If an available amount is specified, the card is first returned to ensure it is not forgotten. The cash is then dispensed and, if required, a receipt is printed. The customer's account details are then updated in the Accounts Database and the procedure terminates.

PROCEDURE Withdrawal (WithdrawalType)
VARIABLES
    Amount IS NUMBER
BEGIN
    input Amount from customer keypad
    read customer's details from accounts database
    IF customer has insufficient funds
        THEN IF customer has zero funds
            THEN BEGIN
                display 'insufficient funds' message
                set Amount to zero
            END
            ELSE BEGIN
                display offer of available funds
                input customer's response (Y/N)
                IF response is 'Y'
                    THEN set reduced Amount
                    ELSE set Amount to zero
                ENDIF
            END
        ENDIF
    ENDIF
    return customer's card
    IF Amount is not zero
        THEN BEGIN
            dispense cash Amount
            IF WithdrawalType is with_receipt
                THEN print receipt for Amount
            ENDIF
            update accounts database
        END
    ENDIF
END Withdrawal

Go To: ATM Project : last : next