Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. case 4: // Requests current PIN, then asks for and sets new PIN
  2. System.out.print("**********************************************"
  3. + "\nEnter current PIN: ");
  4. while (true) {
  5. input = new Scanner(System.in);
  6. String inputtedPin = input.next();
  7.  
  8. // Ensures PIN is 4 number characters
  9. if (!inputtedPin.equals(accounts.get(inputtedId).getPin())) {
  10. System.out.print("Invalid PIN. Please try again: ");
  11. continue;
  12. } else {
  13. // Sets new PIN
  14. System.out.print("\nEnter new 4-digit PIN: ");
  15. inputtedPin = input.next();
  16.  
  17. // Ensures PIN is 4 number characters
  18. while (!inputtedPin.matches("[0-9]{4}")) {
  19. System.out.print("New PIN must be 4 digits. Please try again: ");
  20. inputtedPin = input.next();
  21. }
  22. }
  23.  
  24. // Sets account PIN to the new one
  25. accounts.get(inputtedId).setPin
  26. (inputtedPin);
  27. System.out.println("PIN successfully changed!");
  28. mainMenu(accounts, inputtedId);
  29. break;
  30. }
  31. break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement