Advertisement
Abir10845

Asruvaia_1

Nov 28th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.53 KB | None | 0 0
  1. package Array_String;
  2. import java.util.*;
  3.  
  4.  
  5. public class ASRUvaia {
  6.     static Scanner scan = new Scanner(System.in);
  7.     static String password="asruVaia";
  8.     static String userName="asru181";
  9.        
  10.      
  11.     public static void passwordProtect(){
  12.  
  13.         String uName="";
  14.         String uPassword="";
  15.        
  16.         while(true){
  17.             System.out.println("userName : ");
  18.             uName= scan.next();
  19.            
  20.             System.out.println("password : ");
  21.             uPassword= scan.next();
  22.            
  23.             if(uName.equals(userName) && uPassword.equals(password)){
  24.                 adminePortal();
  25.                 break;
  26.             }else{
  27.                 System.out.println("!Admine is not valied\b");
  28.                 passwordProtect();
  29.             }
  30.         }
  31.     }
  32.    
  33.     public static void main(String[] args) {
  34.        
  35.         System.out.println("Wellcome to our shop");
  36.         System.out.println("\t\tAdmin[press 1]\t\t\bCustomer[press 2]");
  37.         int pressScan=0;
  38.        
  39.         while(true){
  40.             pressScan= scan.nextInt();
  41.             if(pressScan==1) passwordProtect();
  42.             else if(pressScan==2) customerPortal();      
  43.         }
  44.     }
  45.    
  46.    
  47.    
  48.     //**********************************-> For Adminer page
  49.     public static void adminePortal(){
  50.  
  51.             System.out.println("Success");
  52.     }
  53.    
  54.        
  55.    
  56.    
  57.    
  58.     //***********************************-> For Custmer page
  59.     public static void customerPortal(){
  60.        
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement