-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChangePin.java
47 lines (41 loc) · 1.61 KB
/
ChangePin.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import java.util.*;
public class ChangePin extends PIN_Change{
Scanner sc = new Scanner(System.in);
HomeScreen hs = new HomeScreen();
String newPIN, dummyPin, realPin = BankDetails.PIN;
public void ChangePIN(){
System.out.println("Please enter your current PIN:");
dummyPin = sc.nextLine();
if(dummyPin.equals(realPin)){
System.out.println("Please enter your new PIN to proceed:");
newPIN = sc.nextLine();
BankDetails.PIN = newPIN;
System.out.println("Please re-enter your new PIN to confirm:");
String dummyPin2 = sc.nextLine();
if(dummyPin2.equals(BankDetails.PIN)){
System.out.println("Thank you! Your PIN has now been updated.\nPlease wait a few seconds.....");
}
else{
System.out.println("Incorrect PIN entered! Please try again later");
try{
Thread.sleep(3000);
}
catch(InterruptedException e){
System.err.println("Oops! Something went wrong. Please try again later!" + e.getMessage());
}
hs.home_page_display();
}
try{
Thread.sleep(3000);
}
catch(InterruptedException e){
System.err.println("Oops! Something went wrong. Please try again later!" + e.getMessage());
}
}
else{
System.out.println("Incorrect PIN entered! Please try again later.");
hs.home_page_display();
}
hs.home_page_display();
}
}