Assignemnt #60 and Enter PIN

Code

    ///Name: Daniel Tiffany-Appleton
    ///Period: 7
    ///Program Name: Enter PIN
    ///File Name: EnterPIN
    ///Date Finished: 11/18/15
    
    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 JOSHUA.");
    		System.out.print("ENTER YOUR PIN: ");
    		int entry = keyboard.nextInt();
    
            //If you changed the while to an if than the program would end if you get the PIN wrong.
    		//An if statement is different from a while statement because the while continue to give you the code in the brackets while if will just end it.
            
            while ( entry != pin )
    		{
    			System.out.println("\nINCORRECT PIN. TRY AGAIN.");
    			System.out.print("ENTER YOUR PIN: ");
    			entry = keyboard.nextInt();
                
                //the isn't an int because the entry doesn't have to be defined in the while statement.
                //when I remove the entry is that the program broke by printing the same message over and over. This happened because the entry was the like the key to get out of the loop.
    		}
    
    		System.out.println("\nPIN ACCEPTED. YOU NOW HAVE ACCESS TO YOUR ACCOUNT.");
    	}
    }
    

Picture of the output

Assignment 60