javadoc #2
|
@ -31,7 +31,7 @@ public abstract class Account {
|
||||||
return new SavingsAccount(iban, pin, balance, interest);
|
return new SavingsAccount(iban, pin, balance, interest);
|
||||||
} else if (type.equals("Girokonto")) {
|
} else if (type.equals("Girokonto")) {
|
||||||
var overdraft = StringUtils.decodeCurrency(columns[5]);
|
var overdraft = StringUtils.decodeCurrency(columns[5]);
|
||||||
return new Girokonto(iban, pin, balance, overdraft);
|
return new CurrentAccount(iban, pin, balance, overdraft);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Invalid account type: " + type);
|
throw new IllegalArgumentException("Invalid account type: " + type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package me.teridax.jcash.banking;
|
package me.teridax.jcash.banking;
|
||||||
|
|
||||||
public class Girokonto extends Account {
|
public class CurrentAccount extends Account {
|
||||||
|
|
||||||
private final double overdraft;
|
private final double overdraft;
|
||||||
|
|
||||||
public Girokonto(int iban, int pin, double balance, double overdraft) {
|
public CurrentAccount(int iban, int pin, double balance, double overdraft) {
|
||||||
super(iban, pin, balance);
|
super(iban, pin, balance);
|
||||||
this.overdraft = overdraft;
|
this.overdraft = overdraft;
|
||||||
}
|
}
|
|
@ -50,9 +50,9 @@ public class AccountView extends JPanel {
|
||||||
this.balance.setText(StringUtils.LOCAL_NUMBER_FORMAT.format(account.getBalance()) + " €");
|
this.balance.setText(StringUtils.LOCAL_NUMBER_FORMAT.format(account.getBalance()) + " €");
|
||||||
|
|
||||||
this.type.setText(account.getClass().getSimpleName());
|
this.type.setText(account.getClass().getSimpleName());
|
||||||
if (account instanceof Girokonto) {
|
if (account instanceof CurrentAccount) {
|
||||||
this.typeSpecialLabel.setText("Overdraft");
|
this.typeSpecialLabel.setText("Overdraft");
|
||||||
this.typeSpecialProperty.setText( StringUtils.LOCAL_NUMBER_FORMAT.format(((Girokonto) account).getOverdraft()) + " €");
|
this.typeSpecialProperty.setText( StringUtils.LOCAL_NUMBER_FORMAT.format(((CurrentAccount) account).getOverdraft()) + " €");
|
||||||
} else if (account instanceof SavingsAccount) {
|
} else if (account instanceof SavingsAccount) {
|
||||||
this.typeSpecialLabel.setText("Interest rate");
|
this.typeSpecialLabel.setText("Interest rate");
|
||||||
this.typeSpecialProperty.setText( ((SavingsAccount) account).getInterest() + " %" );
|
this.typeSpecialProperty.setText( ((SavingsAccount) account).getInterest() + " %" );
|
||||||
|
|
Loading…
Reference in New Issue