-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBanking.java
More file actions
66 lines (66 loc) · 1.46 KB
/
Copy pathBanking.java
File metadata and controls
66 lines (66 loc) · 1.46 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
66
import java.util.*;
public class Main
{
static Scanner in=new Scanner(System.in);
static int ch;
static int accno;
static int bal;
public static void create()
{
System.out.println("enter acc no");
accno=in.nextInt();
System.out.println("account created");}
public static void deposit(int n)
{
bal=bal+n;
System.out.println("amount deposited");
System.out.println("new balance is "+balance());
}
public static void widthdraw(int n)
{
bal=bal-n;
System.out.println("amount debited");
System.out.println("new balance is "+balance());
}
public static int balance()
{
return bal;
}
public static void main(String arg[])
{
do
{
System.out.println("Enter your option");
System.out.println("1.create account");
System.out.println("2.deposit");
System.out.println("3.widthdraw");
System.out.println("4.balance");
System.out.println("5.exit");
ch=in.nextInt();
switch(ch)
{
case 1:
create();
break;
case 2:
System.out.println("enter amount to deposit");
int dep=in.nextInt();
deposit(dep);
break;
case 3:
System.out.println("enter amount to widthdraw");
int wid=in.nextInt();
widthdraw(wid);
break;
case 4:
System.out.println("balance: "+balance());
break;
case 5:
System.exit(0);
break;
default:System.out.println("invalid choice");
System.exit(0);
}
}while(ch<=5);
}
}