Assignment #59 and Fifty-Sixth Program

Code

        /// Name: Georgi Atanasov
        /// Period: 5
        /// Program Name: Enter Your PIN
        /// File Name: EnterYourPIN.java
        /// Date Finished: 12/3/2015
    
    import java.util.Scanner;

    public class EnterYourPIN
    {
        public static void main(String[] args)
        {
            Scanner keyboard = new Scanner(System.in);
            int pin = 45454;
            
            System.out.println("WELCOME TO THE BANK OF GEORGI.");
            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.");
        }
    }
    
    //while loops run only when conditions are met, like an if statement
    //while loops continue to run until conditions are not met
    //entry was already declared an int variable outside of the while loop
    //the while loop continues to run forever if the inpu variable is taken out
    

Picture of the output

Assignment 63