int main() {
  Account *account = new Account("Jim Johnson");

  account->Deposit(500.0);
  account->Deposit(300.0);
  account->Deposit(550.0);
  account->PayInterest();
  account->Withdraw(2000.0);
  account->Withdraw(1100.0);

  return 0;
}
Account* OpenAccount(double amount, bool savings)
{
	Account* acc;
	if(savings)
		acc = new SavingsAccount;
	else
		acc = new CurrentAccount;
	acc->Deposit(amount);
	return acc;
}
Beispiel #3
0
void Bank::Deposit(const Transaction& tr)
{
	Account info;
	Account* result = NULL;
	string acc = tr.GetAccount();
	string num = acc.substr(0, acc.length() - 1);
	info.SetNumber(num);

	if (!tree.Retrieve(info, result))
	{
		cerr << "ERROR: Account " << num
			<< " not found. Deposit refused." << endl;
		return;
	}
	result->Deposit(tr);
}