Assignemnt #64
Code
/// Name: Holden Ganch
/// Period: 7
/// Program Name: sixty fourth Program
/// File Name: Dice.java
/// Date Finished: 12/9/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 x;
x=4;
System.out.println("WELCOME TO THE BANK OF HOLDEN.");
System.out.println("BE CARFUL YOU ONLY HAVE " + x + " TRIES");
System.out.println("ENTER YOUR PIN: ");
int entry = keyboard.nextInt();
tries++;
while ( entry != pin && tries < x )
{
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. YOU NOW HAVE ACCESS TO YOUR ACCOUNT.");
else if ( tries >= x )
System.out.println("\nYOU HAVE LOCKED THIS ACCOUNT. I SUDGEST RUNNING WE CALLED THE COPS. ");
}
}
Picture of the output