renamed Girokonto to CurrentAccount

This commit is contained in:
Sven Vogel 2023-07-01 12:54:36 +02:00
parent 0c19489b1f
commit a9ae1dc55a
3 changed files with 5 additions and 5 deletions

View File

@ -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);
} }

View File

@ -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;
} }

View File

@ -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() + " %" );