June 2006
Intermediate to advanced
1344 pages
42h 52m
English
Class Keypad (Fig. J.3) represents the keypad of the ATM and is responsible for receiving all user input. Recall that we are simulating this hardware, so we use the computer’s keyboard to approximate the keypad. We use method Console.ReadLine to obtain keyboard input from the user. A computer keyboard contains many keys not found on the ATM’s keypad. We assume that the user presses only the keys on the computer keyboard that also appear on the keypad—the keys numbered 0–9 and the Enter key.
1 ' Keypad.vb 2 ' Represents the keypad of the ATM. 3 Public Class Keypad 4 ' return an integer value entered by user 5 Public Function GetInput() As Integer 6 Return Convert.ToInt32(Console.ReadLine()) ... |
Read now
Unlock full access