Sintak perulangan Login java


berikut sintaknya



import java.util.Scanner;
public class LoginJava {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String username,password;
        int nilaii=0;          
            System.out.println("================================");
            System.out.println("      Silahkan LOGIN Dulu       ");
            System.out.println("================================");
            for (int i =0 ; i<= 5 ; i++){
                nilaii=i+1;
                    System.out.print("Looping Ke " +i+ " Masukan Username : ");
                    username =input.next();
                    System.out.print("Looping Ke "  +i+ " Masukan Password : ");
                    password =input.next();
                    System.out.println("======================================================");
                     if ("IrQa".equals(username) &&("Admin".equals(password))){
                    System.out.println(""+ username + ", SELAMAT DATANG DI HALAMAN LOGIN SEDERHANA INI");
                    break;
                    }
                     else{
                        System.out.println("Login Gagal");
                        System.out.println("=============================================================================");
                        System.out.println("Anda dapat melakukan login kembali < 5 kali dan dimulai dari kesempatan ke :"+nilaii);
                        System.out.println("=============================================================================");
                     }
                if (nilaii >=6){
                    System.out.println("Anda Tidak Berhak Login karena telah Salah menginput data sebanyak "+i);
                }      
            }
         }
         }

1 komentar:

tolong dong, dijelasin untuk tiap step" nya gan ..
terima kasih


EmoticonEmoticon