-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathATMMachine.java
More file actions
58 lines (49 loc) · 2.41 KB
/
Copy pathATMMachine.java
File metadata and controls
58 lines (49 loc) · 2.41 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
53
54
55
56
57
58
import java.util.Scanner;
public class ATMMachine {
public static void main(String[] args) {
int balance = 100000000, withdraw, deposit;
Scanner sc = new Scanner(System.in);
while (true) {
System.out.println("==========================================================");
System.out.println("___________|| Welcome to JP-Group of Bank ATM ||__________");
System.out.println("==========================================================");
System.out.println("Choose 1 for Withdraw");
System.out.println("Choose 2 for Deposit");
System.out.println("Choose 3 for Check Balance");
System.out.println("Choose 4 for Exit");
System.out.println("==========================================================");
System.out.print("Choose the operation you want to perform: ");
int choice = sc.nextInt();
switch (choice) {
case 1:
System.out.print("Enter money to be withdraw: ");
withdraw = sc.nextInt();
if (balance >= withdraw) {
balance = balance - withdraw;
System.out.println("Please collect your Money.");
} else {
System.out.println("Insufficient Balance");
}
System.out.println("");
break;
case 2:
System.out.print("Enter money to be Deposited: ");
deposit = sc.nextInt();
balance = balance + deposit;
System.out.print("Your Money has been successfully Deposited: ");
System.out.println("");
break;
case 3:
System.out.println("Balance: " + balance);
System.out.println("");
break;
case 4:
System.out.println("==========================================================");
System.out.println("_________||Thank You for useing JP-Group of Bank ATM||____");
System.out.println("==========================================================");
System.exit(0);
break;
}
}
}
}