Information Technology Reference
In-Depth Information
us to the procedure for entering a change to the first name and we won't leave it unless
we have entered valid characters.
If
field-no
is 3 , the new balance can be entered. It can positive, negative or 0 and because of the
definition of
new-balance ,
letters of the alphabet and special characters are not allowed. The combination of the
keyword
input
with the definition of the field mean that only a limited number of characters are
acceptable here, namely integers, the negative sign and the decimal point. Note that the
operator needs to enter the decimal point if the amount involves cents, otherwise the
number will be assumed to have no decimal digits. We could have gotten around keying
the decimal point by allowing movement to the decimal portion of the amount with a tab.
However, since either way involves a keystroke, we chose the decimal point. The balance
entering process won't display any error message if the operator keys in a letter of the
alphabet, but the cursor will return to the 19th row and 36th column for another try at it.
If the user feels stuck on the field, all she needs to do is enter 0 for it, even though that's
probably a wrong value.
The next statement asks if
field-no
is 0. Since this procedure is executed over and over, if 0 was keyed it could mean either
that at least one field was changed or perhaps none at all so we need to determine if we
have to update the file. That is why we perform the procedure
update-check .
There is one other possibility in this procedure. Someone could have entered a 4
or 7 here for
field-no ,
either of which is unacceptable. If that happens, we will let them, but notify them by the
message that actually prints the value they keyed. So if they keyed 4 they will see at the
bottom of the screen
4 is invalid
and now the program goes back to the beginning of the procedure for more input. Perhaps
now they will key either 0, 1, 2 or 3 and nothing else.
In any event, we have covered all the lines in the paragraph
get-change ,
so let us proceed to the paragraph
enter-last-name .
The first statement
input-last-name: screen (5,36) input new-last-name
will allow the user to key the last name just to the right of the field label on line 5. The
next line
screen (24,1) erase
Search WWH ::




Custom Search