-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathp06bank.java
More file actions
46 lines (38 loc) · 1.01 KB
/
p06bank.java
File metadata and controls
46 lines (38 loc) · 1.01 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
class Bank {
String DepositorName, AccountType;
float balance;
int accountNumber;
void getValue(String userName, String types, float bal, int accNum) {
DepositorName = userName;
AccountType = types;
balance = bal;
accountNumber = accNum;
}
void Display() {
System.out.println(DepositorName);
System.out.println("Rs. " + balance);
}
void Deposit(float value) {
balance = balance + value;
}
void Withdraw(float val) {
if (balance > val) {
balance = balance - val;
} else {
System.out.println("Insufficient amount!");
}
}
}
public class p06bank {
public static void main(String args[]) {
Bank user = new Bank();
user.getValue("ABC", "Recursive", 40000.60f, 123);
user.Display();
user.Deposit(4700);
user.Display();
user.Withdraw(999999999);
user.Display();
user.Withdraw(999);
user.Display();
}
}