-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAtmWithdrawal.java
More file actions
26 lines (26 loc) · 827 Bytes
/
Copy pathAtmWithdrawal.java
File metadata and controls
26 lines (26 loc) · 827 Bytes
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
import java.util.Scanner;
public class AtmWithdrawal {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int registered_pin=1234,pin,withdrawal_amt;
float balance;
System.out.print("Enter pin : ");
pin=sc.nextInt();
if (pin==registered_pin){
System.out.print("Enter balance : ");
balance=sc.nextFloat();
System.out.print("Enter withdrawal ammount : ");
withdrawal_amt=sc.nextInt();
if (balance>=withdrawal_amt){
System.out.println("Transaction successful");
}
else{
System.out.println("Insufficient balance");
}
}
else{
System.out.println("Incorrect pin");
}
sc.close();
}
}