-
Notifications
You must be signed in to change notification settings - Fork 0
/
SparKonto.java
42 lines (34 loc) · 920 Bytes
/
SparKonto.java
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
package antonfries.konto;
public class SparKonto extends Konto {
private static double sparZins = 1.0;
private static int nextSparKtoNr = 5000;
public final String TYP = "Spar";
public SparKonto(String inhaber, double betrag) {
super(inhaber, betrag);
}
@Override
protected int erzeugeNummer() {
return nextSparKtoNr++; // Postfix-Technik
}
@Override
public void abrechnen() {
betrag *= sparZins;
}
public static void setSparZins(double sparZins) {
SparKonto.sparZins = sparZins;
}
public static double getSparZins() {
return sparZins;
}
@Override
public String getKontoTyp() {
return TYP;
}
@Override
public void print() {
System.out.println(getKontoTyp() + "Konto{" +
"betrag=" + betrag +
", nummer=" + nummer +
'}');
}
}