Guest User

Untitled

a guest
Oct 25th, 2017
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class LogIn extends AddressBook
  4. {
  5. public void menu4me(int choice, int x, String [] ArName, String [] ArEmail, String [] ArPnum, String [] ArAddress)
  6. {
  7. int check=0;
  8. Scanner input= new Scanner(System.in);
  9. String UserName= "admin";
  10. String PassWord= "admin";
  11. if (choice == 1)
  12. {
  13. System.out.println(" ");
  14. System.out.print("USER: ");
  15. String user=input.nextLine();
  16. System.out.print("PASSWORD: ");
  17. String pass=input.nextLine();
  18.  
  19. if(user.equals(UserName))
  20. {
  21. if (pass.equals(PassWord))
  22. {
  23. System.out.println(" ");
  24. System.out.println("WELCOME ADMINISTRATOR");
  25. System.out.println(" ");
  26. for (int j=1; j<x+1; j++)
  27. {
  28. System.out.print(j+" ");
  29. System.out.println(ArName[j-1]);
  30. System.out.println(""+ArEmail[j-1]);
  31. System.out.println(""+ArPnum[j-1]);
  32. System.out.println(""+ArAddress[j-1]);
  33. System.out.println(" ");
  34. }
  35. }
  36. }
  37. else
  38. {
  39. System.out.println("WRONG USER/PASSWORD. TRY AGAIN");
  40. }
  41. }
  42.  
  43. else if (choice == 2)
  44. {
  45. System.out.println(" ");
  46. System.out.println("WELCOME GUEST");
  47. System.out.println(" ");
  48. for (int j=1; j<x+1; j++)
  49. {
  50. System.out.print(j+" ");
  51. System.out.println(ArName[j-1]);
  52. System.out.println(""+ArEmail[j-1]);
  53. System.out.println(" ");
  54. }
  55. }
  56. else
  57. {
  58. System.out.println("WRONG INPUT! TRY AGAIN.");
  59. System.exit(0);
  60. }
  61. }
  62. }
Add Comment
Please, Sign In to add comment