-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatm_interface.java
More file actions
65 lines (57 loc) · 2.47 KB
/
atm_interface.java
File metadata and controls
65 lines (57 loc) · 2.47 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
59
60
61
62
63
64
65
import java.util.*;
public class atm_interface {
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
System.out.println("Welcome to BOI Atm....");
System.out.println("Please insert your Debit card");
String user_Input=sc.nextLine();
System.out.println("Please Wait while we are fetching your Details.....");
System.out.println();
boolean Atm=true;
int total_amount=50000;
while( Atm==true){
System.out.println("please select your option");
System.out.println("Withdraw- press 1");
System.out.println("Deposit- press 2");
System.out.println("Check Balance- press 3");
System.out.println("Exit-press 4");
int number=sc.nextInt();
switch(number){
case 1:
System.out.print("Please Enter your Amount : ");
int amount=sc.nextInt();
System.out.print("Please Enter your PIN number : ");
char pin=sc.next().charAt(0);
if(amount>50000){
System.out.println("you dont have sufficient balance");
System.out.println("your transaction has been declined....");
}
else{
total_amount=total_amount-amount;
System.out.println("Please Wait while your transaction is being processed....");
System.out.println("Please collect your cash");
System.out.println("your transaction has been succesful....");
}
break;
case 2:
System.out.print("please enter your amount to be deposited : ");
amount=sc.nextInt();
System.out.print("Please Enter your PIN number : ");
pin=sc.next().charAt(0);
total_amount=total_amount+amount;
System.out.println("Please Wait while your transaction is being processed....");
System.out.println("Your amount has been successfully deposited");
break;
case 3:
System.out.print("Please Enter your PIN number : ");
pin=sc.next().charAt(0);
System.out.println("your Available balance is : "+total_amount);
break;
case 4:
System.out.println("Please Remove your Debit Card...");
Atm=false;
}
System.out.println();
}
}
}