Assignemnt #64

Code

    ///Name: Joshua Bautista
    ///Period: 6
    ///Project Name: PinLockout
    ///File Name: PinLockout.java
    ///Date: 1/7/2016
    
    class HelloWorld {
    
        import java.util.Scanner;

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

		System.out.println("WELCOME TO THE BANK OF JOSHUA.");
		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 the output

Assignment 1