rendered paste bodypackage oving6;
public class GoldAccount extends AbstractAccount {
private int credit;
public GoldAccount(int credit) {
super();
this.credit = credit;
this.addTransaction(-1000, "f");
}
@Override
public String getAccountType() {
return "Gold account";
}
@Override
public int deposit(int amount) {
if (amount >= 0) {
this.addTransaction(amount, "d");
}
return this.getBalance();
}
@Override
public int withdraw(int amount) {
if (amount > 0 && this.getBalance() - amount >= -credit) {
this.addTransaction(-amount, "w");
}
return this.getBalance();
}
}