Assignment #60 and Enter Your Pin
Code
//Name: Mark Katz
///Period: 6
///Program Name: Enter Your Pin
///File Name: pin.java
///Date Finished: 10/26/15
import java.util.Scanner;
public 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: "); //Name: Mark Katz
entry = keyboard.nextInt();
}
System.out.println("\nPIN ACCEPTED. YOU NOW HAVE ACCESS TO YOUR ACCOUNT.");
}
}
// a while loop is similar to an 'if' statement because a certain critera has to be met in order for a statement to be shown
//a while loop is different because it can be used over and over again
//because an integer has already been declared, so an int entry is a different integer
//if you take it out any other number besides 12345, will end the program
Picture of the output