Assignment #60 and Enter Your Pin
Code
/// Name: Lauren Baird
/// Period: 7
/// Program Name: Enter You Pin
/// File Name: EnterPIN.java
/// Date Finished: 11/3/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 LAUREN.");
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.");
// Like if statements, while loops will only run if requirements are met
// They are different in that while loops will continue to run until the variable is entered correctly
// The entry was said to be an int variable outside of the while loop
// The while loop will continue to run until the input variable is removed
}
}