Advertisement
iFenix24

PasswordAlgorythm

Oct 20th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. package uts;
  2. import java.util.*;
  3. /**
  4.  *
  5.  * @author iFenix
  6.  */
  7. public class blip4{
  8.  
  9.     public static void main(String[] args) {
  10.         Scanner s = new Scanner(System.in);
  11.         String password="abcd123";
  12.         String katasandi;
  13.         boolean sah=true;
  14.         int count=3;        
  15.         while(sah){
  16.             count--;
  17.             if (count>=0){    
  18.                 System.out.println("Masukkan Kata Sandi");
  19.                 katasandi=s.nextLine();
  20.                 if(katasandi.equals(password)){
  21.                     sah=false;
  22.                     System.out.println("Access Granted!");
  23.                 }else{              
  24.                     System.out.println("Salah! Kesempatan anda tersisa "+(count)+" kali");
  25.                     System.out.println("==========================");
  26.                 }
  27.             }else{
  28.                 sah=false;
  29.                 System.out.println("Kesempatan Anda Habis \nAkun anda Terblokir");
  30.             }          
  31.         }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement