Assignemnt #60

Code

/// Name: Ryan Volko
/// Period: 7
/// Program Name: Enter
/// File Name: Enter.java
/// Date Finished: 11/18/2015

import java.util.Scanner;

public class Enter
{
    public static void main( String[] args )
    {
    Scanner keyboard = new Scanner(System.in);
    int pin = 2222;
    
    System.out.println("Welcome to the bank of Volko");
    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 naw hava access to your acount");
        // a while is similar to a if statement because it leads to a seperate section of type
        // a while is different to a if because if the while is wrong you have to try again and you keep going till you get it
        //there isnt an int because it is alrady intalised and you are trying to match it
        //without the entry it loops infinatly without being able to stop it. this happends because it doesnt have an area to put the pin after you mess up the first time
    }
    }
    

Picture of the output

Assignment 60