Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
public class BankAccountInher extends InterestAccount {
private int accountAge;
//Constructors
public BankAccountInher () {
super(0, 0.06);
this.accountAge = 0;
}
public BankAccountInher (double initialBalance) {
super(initialBalance, 0.06);
this.accountAge = 0;
}
//Getters and Setters
public int getAccountAge () { return this.accountAge; }
public void setAccountAge (int a) { this.accountAge = a; }
//Other member functions
/**
* Given a double, add that amount to the balance
* @param sum The amount of money being deposited into the account
* @return The balance after the deposit
*/
public double deposit (double sum) {
super.setBalance(super.getBalance() + sum);
return super.getBalance();
}
/**
* Given a double, add that ammount to the balance
* @param sum The amount of money being withdrawn from the account
* @return The balance after the withdrawal
*/
public double withdraw (double sum) {
super.setBalance(super.getBalance() - sum);
return super.getBalance();
}
/**
* Accrue account for one year
* @return The balance of the account after accrual
*/
@Override
public double accrue () {
accountAge++;
return super.accrue();
}
/**
* Given a number of years, accrue account over years
* @param y The number of years to accrue over
* @return The balance of the account after accrual
*/
@Override
public double accrueYears (int y) {
accountAge += y;
return super.accrueYears(y);
}
}