Assignemnt #60 PIN Lockout

Code

///Name: JJ Deng
///Period: 6
///Program Name: Pin Lockout
///File Name: Pin Lockout.java
///Date Finished:12/15/15

import java.util.Scanner;

public class PinLock
{
	public static void main( String[] args )
	{
		Scanner keyboard = new Scanner(System.in);
		int pin = 12345;
		int tries = 0, ntries= 4;

		System.out.println("WELCOME TO THE BANK OF JJ.");
		System.out.print("ENTER YOUR PIN: ");
		int entry = keyboard.nextInt();
		tries++;

		while ( entry != pin && tries < ntries )
		{
			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 >= 4 )
			System.out.println("\nYOUR ACCOUNT IS NOW LOCKED.");
	}
}
  

Picture of the output

Assignment 60