-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJava code
More file actions
42 lines (42 loc) · 1.36 KB
/
Copy pathJava code
File metadata and controls
42 lines (42 loc) · 1.36 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
import java.util.*;
class atm{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int amount = 1000;
System.out.println("ATM_INTERFACE");
System.out.println("1.Withdraw");
System.out.println("2.Deposit");
System.out.println("3.Check_Balance");
System.out.println("4.Exit");
while (amount>0) {
System.out.print("Choose your option :");
int option = sc.nextInt();
int Balance;
if(option==1){
System.out.print("Enter amount to Withdraw :");
int withdraw = sc.nextInt();
Balance = amount-withdraw;
amount = Balance;
System.out.println("Balance is Rs."+Balance);
}
if(option==2){
System.out.println("Enter the amount to Deposit :");
int deposit = sc.nextInt();
Balance = amount+deposit;
amount = Balance;
System.out.println("Balance amount is Rs."+Balance);
}
if(option==3){
System.out.println("Check_Balance :");
Balance = amount;
amount = Balance;
System.out.println("Balance Amount is Rs."+Balance);
}
if(option==4){
System.out.println("Good_Bye!");
return;
}
}
System.out.println("Thank You");
}
}