Assignment #60


    /// Name: Kabir Virk
    /// Period: 6
    /// Program Name: EnterYourPIN
    /// File Name:
    /// Date Finished: 12/3/2015
    import java.util.Scanner;

    public class EnterYourPIN
        public static void main(String[] args)
            Scanner keyboard = new Scanner(;
            int pin = 12345;
            System.out.println("WELCOME TO THE BANK OF KABIR.");
            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 only run continously when the incorrect input is entered
    //while loops continue to run until correct input is entered
    //entry is already am int variable outside of the while loop
    //while loop continues to run nonstop

Picture of the output

Assignment 60