Assignment #60

Code

    /// Name: Ian Stanko
    /// Period: 5
    /// Program Name: EnterPin
    /// File Name: EnterPin.java
    /// Date Finished: 12/2/2015
    
  import java.util.Scanner;

    public class EnterPin
    {
    	public static void main( String[] args )
    	{
    		Scanner keyboard = new Scanner(System.in);
    		int pin = 13647;
    
    		System.out.println("Welcome to Fells Wargo Bank.");
    		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: "); //Name: Ian Stanko
        
    			entry = keyboard.nextInt();
    		}
    
    		System.out.println("\nPIN ACCEPTED. YOU NOW HAVE ACCESS TO YOUR ACCOUNT.");
    	}
    }
    
    // a while loop is similar to an 'if' statement because a certain critera has to be met in order for a statement to be shown
    //a while loop is different because it can be used over and over again
    //because an integer has already been declared, so an int entry is a different integer
    //if you take out any other number besides 13647, it will end the program
        

    

Picture of the output

Assignment 60