Assignemnt #60 and Enter Your PIN

Code

/// Name: Kyle Ivy
/// Period: 5
/// Program Name: EnterPIN
/// File Name: EnterPIN.java
/// Date Finished: 1/5/2016

   import java.util.Scanner;

    public class EnterPIN {
    
    	public static void main( String[] args ) {
        
    		Scanner keyboard = new Scanner(System.in);
    		int pin = 1234;
    
    		System.out.println("WELCOME TO THE BANK OF KYLE.");
    		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.");
    	}
    }
    
    
    /* 
    1. Both execute statements only if certain conditions are met. 
    2. A while loop will repeat until the conditions are met, and an if statement simply will not execute if statements are not met.
    3. Entry was already defined as an int previously.
    4. It won't let you re-enter the code. It will loop saying that you have an incorrect PIN.
    5. DONE
    */

    

prog60.PNG

Assignment 1