Assignment # 64 and Pin Lockout

Code

    /// Name: Tommy Oyuntseren
    /// Period: 7
    /// Program Name: PinLockout
    /// File Name: PinLockout.java
    /// Date: 12/15/2015

import java.util.Scanner;

public class PinLockout
{
	public static void main( String[] args )
	{
		Scanner keyboard = new Scanner(System.in);
		int pin = 54321;
		int tries = 0;
		int maxTries = 4;

		System.out.println("Welcome to Tommy's Bank.");
		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 accpeted. You now have access to your vault.");
		else if ( tries >= maxTries)
			System.out.println("\nYou have run out of tries, so now you're under arrest.");
	}
}
  

Picture of the output

Assignment 64