Assignemnt #64 and Pin Lockout
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: Pin Lockout
///File Name: PinLockout
///Date Finished: 12/1/15
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 maxTries = 4;
System.out.println("WELCOME TO THE BANK OF JOSHUA.");
System.out.print("ENTER YOUR PIN: ");
int entry = keyboard.nextInt();
tries++;
while ( entry != pin && tries < maxTries )
{
System.out.println("\nINCORRECT PIN. TRY AGAIN.");
System.out.print("ENTER YOUR PIN: ");
entry = keyboard.nextInt();
tries++;
}
if ( entry == pin )
System.out.println("\nPIN ACCEPTED. ACCESING ACCOUNT NOW.");
else if ( tries >= maxTries )
System.out.println("\nSHUT DOWN. ACCESS DENIED.");
}
}
Picture of the output