forked from manav88/javaNS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestAccount.java
More file actions
39 lines (31 loc) · 736 Bytes
/
TestAccount.java
File metadata and controls
39 lines (31 loc) · 736 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
class Account {
int acno;
String name;
float balance;
void deposit(float i) {
balance = balance + i;
System.out.println("Deposited money" + i);
}
void withdraw(float j) {
balance = balance - j;
System.out.println("Withdrawned money" + j);
}
void display() {
System.out.println(name + " " + balance);
}
void insert(int ac, String n, float ba) {
acno = ac;
name = n;
balance = ba;
}
}
class TestAccount {
public static void main(String[] args) {
Account a1 = new Account();
a1.insert(88, "kanu", 0);
a1.deposit(500);
a1.display();
a1.withdraw(500);
a1.display();
}
}