Prog 60: Enter Your PIN
///Name: Ilana Levy
///Period: 5
///Program Name: Enter Your PIN
///File Name: enterPIN.java
///Date Finished: 9/21/2015
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 ILANA." );
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 while loops and if statements only allow certain code to be shown when their conditions are met. Lest the code goes unshown.
//2.while loops repeat a prompt until their conditions are met whereas, if statements come with many different prompts; only one prompt can be present in an if statement and the choices are not repeated.
//3. there is already an int present in the code above which contains the while statemnet and defines "entry" therefore another definition of entry is redundant.
//4. with the entry definition line deleted, the while statement repeats forever because there is no way to make its condition untrue if entry can't be reguessed.
}
}