Assignemnt #64 and PINLockout
Code
/// Name: Brian Phillips
/// Period: 5
/// Program name: Enter Your PIN
/// File Name: PinLockout.java
/// Date Finished: 12/3/2015
import java.util.Scanner;
public class EnterYourPIN
{
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 is simiar to if because you put in circumstances in which the program inputs if the circumstances are met
//While is different because it repeats the statement if the circumstances are not met if you have !
//There is no int in front of line 25 below because if it is the wrong integer it has to repeat
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.");
}
}
Picture of the output