Assignemnt #60 and enter your PIN
Code
///name: nick cerdan
///period: 6
///program name: enter Your PIN
///file name: EnterPIN.java
///date finished: 10/20/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();
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.");
}
}
///a while loop is imilar to an 'if' statement because it has a condition following it that must be fufilled
///a whli loop is different from an 'if' statement because it can be used as many times over and over
///because the variable enter has already been declare an integer in a previous line before the while loop
///if you remove the ability to type the right answer it (very quickly) repeats what thw while loop does when you dont typ ein the right answer