bank-account
A simple bank account created as an everyday example
for the OOP course. Used in particular for demonstrating inheritance.
Construct a bank account from owner.
The interestRate is given the default value 0.0.
The balance is given the default value 0.0.
The owners name. A string.
Construct a bank account from owner, balance, and interestRate.
The interestRate is given the default value 0.0.
The owners name
The initial amount of this account
Construct a bank account from owner, balance, and interestRate.
The owners name
The initial amount of this account
The interest rate.
Annual interet is calculated as balance * interestRate
Withdraw an amount of money from the account.
This decreases the balance of the account.
The amount of money to withdraw from the account.
Precondition: Must be non-negative.
Withdraw an amount of money from the account.
This increases the balance of the account.
The amount of money to deposit to the account.
Precondition: Must be non-negative.
Add the annual interest to the account.
This may increase the current balance of the account.
Return a text string that represents this account
for output purposes
Returns the current amount of the bank account
without affecting the account.
Accesses the amount of money in the account
Return the interest rate of the account
Accesses the interest rate of the account