Assignment 60

code

///Name: Mutsu Osoeogawa
///Period: 7
///Project Name: Enter Your Pin
///File Name: EnterPin.java
///Date: 11/13/2015

import java.util.Scanner;

public class EnterPIN
{
    public static void main( String[] args )
    {
        Scanner keyboard = new Scanner(System.in);
        int pin = 12345;
        
        System.out.println( "WELCOME TO THE BANK OF MUTSU." );
        System.out.print( "ENTER YOUR PIN: " );
        int entry = keyboard.nextInt();
        
        while ( entry != pin )
        {
            System.out.println( "\nINCORRECT PIN. TRY AGAIN. " );
            System.out.println( "ENTER YOUR PIN: " );
            entry = keyboard.nextInt(); 
        }
        System.out.println("\nPIN ACCEPTER. YOU NOW HAVE ACCESS TO YOUR ACCOUNT. " );
        //while loops are similar to an if statement because it gives a condition on how to proceed the program
        //while loops are different to an if statement because it repeats the action until the condition is met
        //there is no int in front of the line entery = keyboard.nextInt() because the entry int variable was                 already initialized before
        // deleting entry = keyboard.nextIN90 from inside the while loop creates a continuous loop because the               condition was not met
    }
}