All pastes #368778 Raw Edit

Mine

public text v1 · immutable
#368778 ·published 2007-02-23 09:47 UTC
rendered paste body
package 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();
	}
}