-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBank.java
More file actions
48 lines (48 loc) · 1.03 KB
/
Copy pathBank.java
File metadata and controls
48 lines (48 loc) · 1.03 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
class Bank
{
int ano;
String ahnam;
double bal;
public void accept(int a, String an, double b)
{
ano = a;
ahnam = an;
bal = b;
}
public void deposit(int b)
{
bal = bal + b;
}
public void withdraw(int b)
{
if(bal >= b)
{
bal = bal - b;
}
else
{
System.out.println("Insufficient Balance");
}
}
public void display()
{
System.out.println("Account Number: " + ano);
System.out.println("Account Holder Name: " + ahnam);
System.out.println("Balance: " + bal);
}
public static void main(String[] args)
{
Bank obj1 = new Bank();
obj1.accept(12345, "John Doe", 1000.0);
obj1.deposit(500);
obj1.display();
obj1.withdraw(200);
obj1.display();
Bank obj2 = new Bank();
obj2.accept(12345, "Sanket", 10000.0);
obj2.deposit(5000);
obj2.display();
obj2.withdraw(2200);
obj2.display();
}
}