Assignment #60 Enter Your Pin

Code

    
    /// Name: Lacey Reese 
    /// Period: 5
    /// Program Name:  EnterYourPin
    /// File Name:  EnterYourPin.java
    /// Date Finished 11/20/2015
    
   
   import java.util.Scanner;
    
    public class EnterYourPin 
    {
    	
        public static void main( String[] args ) 
        {
    		Scanner keyboard = new Scanner(System.in);
            
        // A while statement is like a repeating if statement like an If statement, if the test condition is true the statments get executed.
        // The difference is that after the statements have been executed, the test condition is checked again. If it is still true the statements get executed again.This cycle               repeats until the test condition evaluates to false.
        // The entry is defined as an integer
        // The while loop continues to run because the entry originally stays defined.
            
    		int Pin = 12345;
    
    		System.out.println("WELCOME TO THE BANK OF LACEY.");
    		System.out.print("ENTER YOUR PIN: ");
    		int entry = keyboard.nextInt();
    
    		while ( entry != Pin )
    		{
    			System.out.println("\nINCORRECT PIN. TRY AGAIN.");
    			System.out.print("ENTER YOUR PIN: ");
    			entry = keyboard.nextInt();
    		}
    
    		System.out.println("\nPIN ACCEPTED. YOU NOW HAVE ACCESS TO YOUR ACCOUNT.");
        
        }
    }
        
    

    

Picture of the output

// Assignment 60