-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBanking.java
More file actions
49 lines (42 loc) · 1.21 KB
/
Copy pathBanking.java
File metadata and controls
49 lines (42 loc) · 1.21 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
package practice;
import java.util.Scanner;
public class Banking {
static Scanner sc = new Scanner(System.in);
static int balance = 2543;
static String acchldname = "Aadhityaa";
static int pno = 4532;
public static void main(String[] args) {
System.out.println("Welcome to hdfc bank");
System.out.println("Enter pin no.");
int pnno = sc.nextInt();
if(pno==pnno) {
System.out.println("Welcome "+acchldname);
System.out.println("Choose an option from the below");
System.out.println("1. Withdraw 2. Deposit");
int opt = sc.nextInt();
if (opt==1){
withdraw();
}
else if (opt==2) {
deposit();
}
}
else {
System.out.println("Incorrect pin no.");
}
}
public static void withdraw(){
System.out.println("Enter the amount to be withdrawn");
int amt = sc.nextInt();
int newbal = balance - amt;
System.out.println("Your transaction is being processed:");
System.out.println("Balance is "+newbal);
}
public static void deposit() {
System.out.println("Enter the amount that you want to deposit");
int amt = sc.nextInt();
int newbal = balance + amt;
System.out.println("Your transaction is being processed:");
System.out.println("Your Current balance is:"+newbal);
}
}