All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.greenpepper.samples.application.bank.CheckingAccount Maven / Gradle / Ivy

There is a newer version: 4.2.4
Show newest version
package com.greenpepper.samples.application.bank;


/**
 * 

CheckingAccount class.

* * @author oaouattara * @version $Id: $Id */ public class CheckingAccount extends BankAccount { private Money maxCredit = Money.ZERO; /** *

Constructor for CheckingAccount.

* * @param number a {@link java.lang.String} object. * @param owner a {@link com.greenpepper.samples.application.bank.Owner} object. */ public CheckingAccount(String number, Owner owner) { super(AccountType.CHECKING, number, owner); } /** {@inheritDoc} */ public void checkFunds(Money amount) throws Exception { if (getBalance().plus(maxCredit).lowerThan(amount)) throw new Exception("Not enougth credit !"); } /** *

setCreditLine.

* * @param credit a {@link com.greenpepper.samples.application.bank.Money} object. */ public void setCreditLine(Money credit) { this.maxCredit = credit; } /** *

limitFor.

* * @param type a {@link com.greenpepper.samples.application.bank.WithdrawType} object. * @return a {@link com.greenpepper.samples.application.bank.Money} object. */ public Money limitFor(WithdrawType type) { return AccountType.CHECKING.limitFor(type); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy