Assignment 60: Enter Your PIN
Code
/// Name: Ryan McAteer
/// Period: 5
/// Program Name: Enter Your PIN
/// File Name: Assignment60.java
/// Date Finished: 11/17/15
import java.util.Scanner;
public class Assignment60
{
//1) They are similar because they have requirements that need to be met//
//2) While loops repeat unlike if statements//
//3) Because it has been established entry is an int//
//4) The message repeats for ever because you can not re enter the PIN//
public static void main ( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int pin = 12345;
System.out.println("WELCOME TO THE BANK OF RYAN.");
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.");
}
}
Picture of the output