Topic: Savings Account
Instructor: Dana Steil
Expected review Material:
You will be creating a class to represent a simple savings account with a few data members and functions.
Be sure each of the following functions are used.
CSavingsAccount(const char* Owner, const double MinimumBalance,
const double InitialBalance = 0); - For a savings account to be created an owner and minimum balance are required.
double Balance(); - Returns the balance of the savings account.
static double AnnualInterestRate(); - Returns the AnnualInterestRate.
const char* Owner(); - Returns a pointer to the Owner.
void CalculateMonthlyInterest(); - Calculates the monthly interest by multiplying the balance by the annual interest rate and then dividing that amount by the TIMES_INTEEST_PAID_PER_YEAR.
void DepositFunds(const double Amount); - adds the argument amount to the balance
void WithdrawFunds(const double Amount, bool& Success); - subtracts the argument amount from the balance. Check to make sure that the balance does not become negative. If the withdraw amount is greater than the balance do not remove any funds and set the Success flag to false.
static UpdateInterestRate(const double NewAnnualInterestRate, bool& Success); - Updates the interest rate. Checks to make sure the new interest rate is valid, if it is not the interest rate remains the same and the Success flag is set to false.
bool ValidBalance( const double Balance); - Utility function that returns true if the Balance is greater than or equal to the MIN_BALANCE, false otherwise.
static bool ValidInterestRate(const double InterestRate); - Utility function that returns true if the Interest rate is greater than or equal to the MIN_INTEREST_RATE and less than or equal to the MAX_INTEREST_RATE, false otherwise.
Write a test program that will:
1. Create multiple Savings Accounts using the each of its possible constructors.
2. Test each of the public member functions using the objects created above.
Each students test program may very. Part of your grade will reflect the thoroughness of your test program.