Guest User

Untitled

a guest
Jan 22nd, 2020
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. import java.util.*;
  2. public class project2 {
  3.  
  4. public static void main(String[] args) {
  5. int a;
  6. String USERNAME;
  7. String PASSWORD;
  8. USERNAME="Akshit";
  9. PASSWORD="12345";
  10. Scanner sc = new Scanner(System.in);
  11. System.out.println("======MENU======");
  12. System.out.println("1. LOGIN AS USER");
  13. System.out.println("2. LOGIN AS ADMIN");
  14. System.out.println("SELECT THE ACCESS:");
  15. a=sc.nextInt();
  16. switch(a)
  17. {
  18. case 1:
  19. System.out.println("=====USER LOGIN====");
  20. Scanner it = new Scanner(System.in);
  21. System.out.println("USERNAME:");
  22. String Username = it.next();
  23. System.out.println("PASSWORD");
  24. String Password = it.next();
  25. break;
  26. case 2:
  27. System.out.println("=====ADMIN LOGIN====");
  28. Scanner it2 = new Scanner(System.in);
  29. System.out.println("USERNAME");
  30. String username1 = it2.next();
  31. System.out.println("PASSWORD");
  32. String password1 = it2.next();
  33. break;
  34. default:
  35. System.out.println("Error");
  36. }
  37. if(Username.equals(USERNAME) && Password.equals(PASSWORD))
  38. {
  39. System.err.println("========ACCESS GRANTED========");
  40. }
  41.  
  42. }
  43.  
  44. }
Add Comment
Please, Sign In to add comment