Advertisement
Guest User

Untitled

a guest
Jul 9th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.98 KB | None | 0 0
  1. public static void main(String[] args) {
  2.  
  3. Scanner userinput = new Scanner(System.in);
  4.  
  5. String full_name = "James Burton";
  6. String full_name2 = "Brian Ross";
  7. String full_name3 = "Bill Gates";
  8. String password = "thomas";
  9.  
  10. System.out.println("Please sign in.");
  11. System.out.println("Full name, please: ");
  12.  
  13. boolean game = true;
  14.  
  15. while (game) {
  16.  
  17. String username;
  18. username = userinput.nextLine();
  19.  
  20. if (username.equalsIgnoreCase(full_name) || username.equalsIgnoreCase(full_name2) || username.equalsIgnoreCase(full_name3)) {
  21.  
  22. System.out.println("Hello, " + username + ".");
  23. break;
  24.  
  25. } else {
  26. System.out.println("Sorry that was incorrect try again.");
  27. }
  28.  
  29. }
  30.  
  31. System.out.println("Please enter your password: ");
  32.  
  33. boolean pass = true;
  34.  
  35. while (pass) {
  36.  
  37. String check;
  38. check = userinput.next();
  39. if (check.equals(password)) {
  40. System.out.println("Welcome.");
  41. break;
  42. } else {
  43. System.out.println("Sorry that was incorrect. Try again.");
  44. }
  45. }
  46.  
  47. System.out.println("Let's get started, shall we? What game would you like to play?");
  48. System.out.println("1) Checkers");
  49. System.out.println("2) Connect Four");
  50. System.out.println("3) Minesweeper");
  51.  
  52. boolean games = true;
  53.  
  54. while (games) {
  55. String game_choice;
  56. game_choice = userinput.next();
  57. if (game_choice.equalsIgnoreCase("Checkers") || game_choice.equals("1")) {
  58. System.out.println("Ok. Enjoy checkers.");
  59. break;
  60. } else if (game_choice.equalsIgnoreCase("connect four") || game_choice.equals("2")) {
  61. System.out.println("Ok. Enjoy connect four.");
  62. break;
  63. } else if (game_choice.equalsIgnoreCase("minesweeper") || game_choice.equals("3")) {
  64. System.out.println("Ok. Enjoy minesweeper.");
  65. break;
  66. } else {
  67. System.out.println("Sorry, please type in either the game name or the number besides it. Thank you!");
  68. }
  69.  
  70.  
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement