MrDoyle

Enter Your PIN

Nov 13th, 2020
605
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner keyboard = new Scanner (System.in);
  7.         int pin = 12345;
  8.  
  9.         System.out.println("Welcome to the bank of Doyle");
  10.         System.out.println("Please enter your PIN: ");
  11.         int entry = keyboard.nextInt();
  12.  
  13.         while (entry != pin){
  14.             System.out.println("\nIncorrect PIN. Please try again.");
  15.             System.out.println("Please enter your PIN: ");
  16.             entry = keyboard.nextInt() ;
  17.         }
  18.         System.out.println("\nPIN accepted. You now have access to your account");
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment