-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBankMain.java
More file actions
50 lines (50 loc) · 909 Bytes
/
BankMain.java
File metadata and controls
50 lines (50 loc) · 909 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class Bank
{
String name;
int acno,bal;
void open(int a,String b,int c)
{
acno = a;
name = b;
bal = c;
}
void withdraw(int amt)
{
if(bal>amt)
{
System.out.println("You have sufficient amount");
System.out.println("Thank you for withdrawing your amount");
bal = bal-amt;
}
else
{
System.out.println("Insufficient Balance!");
System.out.println("Your Balance is : "+bal);
System.out.println("You cannot withdraw your amount");
System.out.println("Thank you for your visit");
}
}
void deposite(int amt)
{
bal = bal+amt;
System.out.println("Your Balance is : "+bal);
System.out.println("Thank you!");
}
void enquiry()
{
System.out.println(acno+" "+name+" "+bal);
}
}
class Main
{
public static void main(String S[])
{
Bank B1 = new Bank();
System.out.println("You withdrew Rs.2000");
System.out.println("You Deposited Rs.5000");
B1.open(1001,"Jatin",20000);
B1.withdraw(2000);
B1.deposite(5000);
B1.enquiry();
}
}