Assignment #64 and PIN Lockout
Code
///John Mulligan
///period 5
///Program Name: PinLockout
///File Name: PinLockout.java
import java.util.Scanner;
public class PinLockout
{
public static void main( String[] args)
{
Scanner bot = new Scanner(System.in);
int pin = 12345;
int tries = 0;
System.out.println("Welcome to Bank Bank Bank Bank Bank.");
System.out.println("Enter your pin: ");
int entry = bot.nextInt();
tries++;
while ( entry != pin && tries < 3 )
{
System.out.println("\nIncorrect PIN. Try again.");
System.out.println("Enter your PIN: ");
entry = bot.nextInt();
tries++;
}
if (entry == pin )
System.out.println("\nPIN accepted. You can access your account.");
else if ( tries >= 3 )
System.out.println("\nYou have run out of tries. Account locked. IM CALLING THE POLICE! >:O.");
}
}