Assignment #64 and PIN Lockout
Code
/// Name: Lauren Baird
/// Period: 7
/// Program Name: PIN Lockout
/// File Name: PinLockout.java
/// Date Finished: 11/4/2015
import java.util.Scanner;
public class PinLockout
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int pin = 12345;
int tries = 0;
int max = 4;
System.out.println("WELCOME TO THE BANK OF LAUREN.");
System.out.print("ENTER YOUR PIN: ");
int entry = keyboard.nextInt();
tries++;
while ( entry != pin && tries < max )
{
System.out.println("\nINCORRECT PIN.");
System.out.print("ENTER YOUR PIN: ");
entry = keyboard.nextInt();
tries++;
}
if ( entry == pin )
System.out.println("\nPIN ACCEPTED. YOU CAN NOW ACCESS YOUR ACCOUNT.");
else if ( tries >= max )
System.out.println("\nYOU HAVE BEEN LOCKED OUT.");
}
}