Advertisement
Guest User

Untitled

a guest
Apr 15th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class RegisterAndLogin {
  4.  
  5. public static void main(String[] args) {
  6. // TODO Auto-generated method stub
  7.  
  8. Scanner input = new Scanner(System.in);
  9.  
  10. // PLAYER 1 REGISTER
  11. System.out.println("~~~Player 1 REGISTER~~~");
  12. System.out.println();
  13.  
  14. System.out.println("PLAYER 1: Enter Username");
  15.  
  16. String Register1UserName = input.nextLine();
  17. System.out.println();
  18.  
  19.  
  20. System.out.println("PLAYER 1: Enter PassWord");
  21.  
  22. String Register1PassWord = input.nextLine();
  23. System.out.println();
  24.  
  25.  
  26. // PLAYER 2 REGISTER
  27. System.out.println("~~~Player 2 REGISTER~~~");
  28. System.out.println();
  29.  
  30.  
  31.  
  32. System.out.println("PLAYER 2: Enter Username");
  33.  
  34. String Register2UserName = input.nextLine();
  35. System.out.println();
  36.  
  37. System.out.println("PLAYER 2: Enter PassWord");
  38.  
  39. String Register2PassWord = input.nextLine();
  40. System.out.println();
  41.  
  42. // PLAYER 1 LOGIN
  43.  
  44. System.out.println("~~~Player 1 LOGIN~~~");
  45. System.out.println();
  46.  
  47. System.out.println("PLAYER 1: Enter Username");
  48. String Login1UserName = input.nextLine();
  49. System.out.println();
  50.  
  51. System.out.println("PLAYER 1: Enter PassWord");
  52. String Login1PassWord = input.nextLine();
  53. System.out.println();
  54.  
  55. // PLAYER 2 LOGIN
  56. System.out.println("~~~Player 2 LOGIN~~~");
  57.  
  58. System.out.println("PLAYER 2: Enter Username");
  59. String Login2UserName = input.nextLine();
  60. System.out.println();
  61.  
  62. System.out.println("PLAYER 2: Enter PassWord");
  63. String Login2PassWord = input.nextLine();
  64.  
  65. //Checks if username and PassWord are the same
  66.  
  67. if (Register1UserName.equals(Login1UserName) && Register1PassWord.equals(Login1PassWord)) {
  68.  
  69. System.out.println("Player 1 has successfully logged in.");
  70.  
  71. } else {
  72. System.out.println("PLAYER 1 LOGIN FAILED");
  73. System.out.println();
  74.  
  75. }
  76.  
  77. if (Register2UserName.equals(Login2UserName) && Register2PassWord.equals(Login2PassWord)) {
  78.  
  79. System.out.println("Player 2 has successfully logged in.");
  80.  
  81. } else {
  82. System.out.println("PLAYER 2 LOGIN FAILED");
  83. System.out.println();
  84.  
  85. }
  86. }
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement