Overview
You must write a driver that tests all aspects of the
SavingsAccount and MixedSavingsAccount
classes.
Getting Started:
int main(void)
{
double amount;
FixedTermSavingsAccount fixed;
SavingsAccount savin;
MixedSavingsAccount mixed = MixedSavingsAccount(1000.0);
cout << "FTSA Account ID (should be 10000): "
<< fixed.getAccountID() << "\n";
cout << "FTSA - Initial (should be 0): "
<< fixed.getBalance() << "\n";
fixed.deposit(100);
cout << "FTSA - After deposit of 100 (should be 100): "
<< fixed.getBalance() << "\n";
cout << "\n\n";
cout << "SA Account ID (should be 20001): "
<< savin.getAccountID() << "\n";
cout << "SA - Initial (should be 0): "
<< savin.getBalance() << "\n";
savin.deposit(100);
cout << "SA - After deposit of 100 (should be 100): "
<< savin.getBalance() << "\n";
savin.withdraw(50);
cout << "SA - After withdrawal of 50 (should be 50): "
<< savin.getBalance() << "\n";
savin.withdraw(1000);
cout << "SA - After withdrawal of 1000 (should be 50): "
<< savin.getBalance() << "\n";
cout << "\n\n";
cout << "MSA Account ID (should be 30002): "
<< mixed.getAccountID() << "\n";
cout << "MSA - Initial (should be 0): "
<< mixed.getBalance() << "\n";
mixed.deposit(100);
cout << "MSA - After deposit of 100 (should be 100): "
<< mixed.getBalance() << "\n";
mixed.withdraw(50);
cout << "MSA - After withdrawal of 50 (should be 50): "
<< mixed.getBalance() << "\n";
mixed.deposit(1100);
cout << "MSA - After deposit of 1100 (should be 1000): "
<< mixed.getBalance() << "\n";
mixed.withdraw(50);
cout << "MSA - After withdrawal of 50 (should be 950): "
<< mixed.getBalance() << "\n";
mixed.withdraw(50);
cout << "MSA - After withdrawal of 50 (should be 900): "
<< mixed.getBalance() << "\n";
cout << "\n\n";
}
Copyright 2010