-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainClass.java
More file actions
52 lines (42 loc) · 1.81 KB
/
MainClass.java
File metadata and controls
52 lines (42 loc) · 1.81 KB
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
48
49
50
51
52
import java.util.Scanner;
public class MainClass {
public static void main(String[] args) {
AtmOperationInterf op = new AtmOperationImpl();
int atmnumber = 12345;
int atmpin = 123;
Scanner in = new Scanner(System.in);
System.out.println("Welcome to ATM Machine!");
System.out.println("Enter ATM Number: ");
int atmNumber = in.nextInt();
System.out.println("Enter Pin: ");
int pin= in.nextInt();
if(atmnumber == atmNumber && atmpin == pin ){
while(true){
System.out.println("1. View Available Balance \n2. Withdraw Amount\n3. Deposit Amount\n4. View Ministatement\n5. Exit ");
System.out.println("Enter Choice: ");
int ch = in.nextInt();
if(ch==1){
op.viewBalance();
} else if (ch==2) {
System.out.println("Enter amount to Withdraw");
double withdrawAmount = in.nextDouble();
op.withdrawAmount(withdrawAmount);
} else if (ch==3) {
System.out.println("Enter amount to Deposit : ");
double depositAmount = in.nextDouble();
op.depositAmount(depositAmount);
} else if (ch==4) {
op.viewMiniStatement();
} else if (ch==5) {
System.out.println("Collect your ATM Card\n Thank You for using ATM Machine");
System.exit(0);
}else{
System.out.println("Please enter correct Choice.");
}
}
}else{
System.out.println("Incorrect ATM Number or Pin");
System.exit(0);
}
}
}