Assignemnt #64 - Pin Lock

Code

    /// Name: Caelan Dorstad
    /// Period: 6
    /// Program Name: PinLock
    /// File Name: PinLock.java
    /// Date Finished: 1/5/2016
    
    import java.util.Scanner;
    
    public class PinLock
    {
    	public static void main( String[] args )
    	{
    		Scanner keyboard = new Scanner(System.in);
    		int pin = 990112;
    		int tries = 0;
            int maxtry = 4;
    
    		System.out.println("WELCOME TO THE BANK OF JAMES.");
    		System.out.print("ENTER YOUR PIN: ");
    		int entry = keyboard.nextInt();
    		tries++;
    
    		while ( entry != pin && tries < maxtry )
    		{
    			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 >= maxtry )
    			System.out.println("\nYOU HAVE RUN OUT OF TRIES. ACCOUNT LOCKED.");
    	}
    }
    

Picture of the output

Assignment 26