Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case 4: // Requests current PIN, then asks for and sets new PIN
- System.out.print("**********************************************"
- + "\nEnter current PIN: ");
- while (true) {
- input = new Scanner(System.in);
- String inputtedPin = input.next();
- // Ensures PIN is 4 number characters
- if (!inputtedPin.equals(accounts.get(inputtedId).getPin())) {
- System.out.print("Invalid PIN. Please try again: ");
- continue;
- } else {
- // Sets new PIN
- System.out.print("\nEnter new 4-digit PIN: ");
- inputtedPin = input.next();
- // Ensures PIN is 4 number characters
- while (!inputtedPin.matches("[0-9]{4}")) {
- System.out.print("New PIN must be 4 digits. Please try again: ");
- inputtedPin = input.next();
- }
- }
- // Sets account PIN to the new one
- accounts.get(inputtedId).setPin
- (inputtedPin);
- System.out.println("PIN successfully changed!");
- mainMenu(accounts, inputtedId);
- break;
- }
- break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement