Assignemnt #64

Code

///colin hinton
///5th period
///Lockout
///Lockout.java
///11/4/2015

import java.util.Scanner;

class Lockout
{
    public static void main (String [] args)
    {
        Scanner keyboard = new Scanner(System.in);
        
        int pin = 12345;
        int tries = 0;
        int max = 4;
        System.out.println("Welcome to the bank of cloin.");
        System.out.print("Enter your pin: ");
        int entry = keyboard.nextInt();
        tries++;
        
        while ( entry != pin && tries < max)
        {
            System.out.println("Incorrect pin. Try again");
            System.out.print("Enter your pin: ");
            entry = keyboard.nextInt();
            tries++;
        }
        if (entry == pin)
        {
            System.out.println("PIN ACCEPTED WELCOME TO BANK.");
        }
        else if (tries >= max)
        {
            System.out.println("ACCOUNT LOCKED, NO MORE TRIES");
        }
    }
}

    

Picture of the output

Assignment 1