PIN Lockout

Files Needed

(Do not re-type this program. Simply download a copy of the file by right-clicking and choosing "Save link as..." from the context menu. Save it into your normal code folder.)

What You Should See

WELCOME TO THE BANK OF MITCHELL.
ENTER YOUR PIN: 10101

INCORRECT PIN. TRY AGAIN.
ENTER YOUR PIN: 23232

INCORRECT PIN. TRY AGAIN.
ENTER YOUR PIN: 99999

YOU HAVE RUN OUT OF TRIES. ACCOUNT LOCKED.

Study Drills

  1. Change the code so that it locks them out after 4 tries instead of 3. Make sure to change the message at the bottom, too.
  2. Move the "maximum tries" value into a variable, and use that variable everywhere instead of just the number.



©2013–2015 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License