Guest User

Untitled

a guest
Apr 20th, 2018
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. package me.user.school;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Main {
  6. public static void main(String[] args) {
  7. Scanner input = new Scanner(System.in);
  8. System.out.println("Create a username:");
  9. String user = input.next();
  10.  
  11. System.out.println("Create a password:");
  12. String pass = input.next();
  13.  
  14. System.out.println("Your credentials are set.");
  15. second(user, pass);
  16. }
  17.  
  18. private static void second(String user, String pass) {
  19. Scanner input = new Scanner(System.in);
  20. System.out.println("Enter your username:");
  21. String user2 = input.next();
  22.  
  23. System.out.println("Enter your password:");
  24. String user3 = input.next();
  25.  
  26. if (user2.equals(user) && user3.equals(pass)){
  27. System.out.println("Verifying...");
  28. System.out.print("Welcome! ");
  29.  
  30. } else {
  31. System.out.println("Verifying...");
  32. System.out.println("Incorrect credentials!");
  33. second(user, pass); }
  34. System.out.println("Are you okay if I call you " + user + "?");
  35. String decision = input.next();
  36. if (decision.equalsIgnoreCase("yes"))
  37. {System.out.println("Good to know, " + user + ". " + "What would you like to do?");
  38. System.out.println("1 - open calculator");
  39. System.out.println("2 - log off");
  40. System.out.println("3 - close menu");
  41.  
  42. } else {
  43. System.out.println("What would you like me to call you?");
  44. input.nextLine();
  45. String person = input.nextLine();
  46. System.out.println("No problem, " + person + ".");
  47. System.out.println("What would you like to do, " + person + "?");
  48. System.out.println("1 - open calculator");
  49. System.out.println("2 - log off");
  50. System.out.println("3 - close menu");
  51. System.out.println("4 - password generator");
  52. }
  53. int x = input.nextInt();
  54. switch (x){
  55. case 1:
  56. System.out.println("Loading...");
  57. System.out.println("Calculator loaded.");
  58. System.out.println("Enter first integer:");
  59. int y = input.nextInt();
  60. System.out.println("Enter second integer:");
  61. int z = input.nextInt();
  62. System.out.println("Adding numbers...");
  63. System.out.print(y + z);
  64. System.out.println(" is the answer.");
  65. return;
  66. case 2:
  67. System.out.println("Logging off...");
  68. second(user, pass);
  69. case 3:
  70. System.exit(0);
  71. break;
  72.  
  73. }
  74. }
  75.  
  76. }
Add Comment
Please, Sign In to add comment