-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBankapp.java
More file actions
41 lines (36 loc) · 765 Bytes
/
Copy pathBankapp.java
File metadata and controls
41 lines (36 loc) · 765 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
package day24;
abstract class Account{
int acno;
String name;
float balance;
abstract float depoist(float x);
abstract float withdraw(float x);
abstract float getRoi();
}
class SavingAccounts extends Account{
@Override
float withdraw(float x) {
balance-=x;
return balance;
}
@Override
float depoist(float x) {
balance+=x;
return balance;
}
float getRoi() {
return 4.0f;
}
}
public class Bankapp {
public static void main(String[] args) {
Account a1=new SavingAccounts();
a1.depoist(500);
float i=a1.depoist(100);
System.out.println(i);
float w=a1.withdraw(100);
System.out.println(w);//with abstact we can typecast the getRoi variable
float f= a1.getRoi();
System.out.println(f);
}
}