Assignemnt #60: Enter Your PIN
Code
///Name: Cassie
///Period: 6
///Program Name: Enter Your PIN
///File Name: pin.java
///Date Finished: 12/4/15
import java.util.Scanner;
class pin
{
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.");
//it gives the program options for possible answers
//it keeps looping until the right answer is given
//because that the second one tells the program what the possible answer would be
}
}
Picture of the output