Assignemnt #64 PIN Lockout

Code

    ///Name: Morgan Kaplan
    ///Period: 5
    ///Project Name: PIN Lockout
    ///File Name: PINLock.java

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, maxtries=4;

		System.out.println("WELCOME TO THE BANK OF Momo.");
		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. YOU NOW HAVE ACCESS TO YOUR ACCOUNT.");
		else if ( tries >= maxtries)
			System.out.println("\nYOU HAVE RUN OUT OF TRIES. ACCOUNT LOCKED.");
	}
}
    

Picture of Output

Assignment 64