-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
51 lines (43 loc) · 1.82 KB
/
Copy pathMain.java
File metadata and controls
51 lines (43 loc) · 1.82 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
import java.util.*;
public class Main {
public static void main(String[] args) {
AtmOperationImpl op = new AtmOperationImpl();
int atmnumber = 12345;
int atmpin = 123;
Scanner in = new Scanner(System.in);
System.out.println("Welcone to ATM Machine !!!");
System.out.print("Enter Atm number: ");
int atmNumber = in.nextInt();
System.out.print("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();//5000
op.depositAmount(depositAmount);
} else if (ch == 4) {
op.viewMiniStatement();
} else if (ch == 5) {
System.out.println("Collect your ATM Card\nThank you for using ATM Machine !!");
System.exit(0);
} else {
System.out.println("Please enter correct choice");
}
}
// System.out.println("Validation done");
} else {
System.out.println("Incorrect Atm number or pin");
System.exit(0);
}
}
}