case'C':
case'c':
cout << fixed << showpoint << setprecision(2) << endl;
cout << "\n\nCHECKING account " << CAnumber << " total is: "
<< CAtotal << endl;
cout << "\n\tPlease enter the amount you"
<< " would like to withdrawl: ";
cin >> temp;
cout << "\n\tYou have chosen to withdrawl "
<< temp << ".";
check.transactionsC();
recTran();
if ((CAtotal -=temp) > 0)//<--when accessed, it subtracts twice
{
CAtotal -=temp;
cout << "\n\tYour new total is: " << CAtotal<<endl;
}
elseif ((CAtotal -=temp) <= 0)
{
insufficent();
CAtotal += fee;
}
elseif (temp >= 10000)
{
cout << "\nWOW!!!That's quite a bit of pocket cash!!\n"
<< "do you really need that much!?!?(It's a simulator.)\n";
}
break;
default:
cout << "\n\n\tttINVALID SELECTION, PLEASE TRY AGAIN";
break;
}
}
other functions called
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
void CheckingAccount::transactionsC()
{
tran++;
recTran();
fee = 5.00;
if (tran >= 4)
{
withdrawl();
CAtotal -= fee;
cout << "\tA transaction fee of $" << fee
<< " has been withdrawl\n"
<< "\tfor (3) or more transactions, you have\n"
<< "\treached " << tran << " transactions"
<< "\ton this CHECKING account.\n";
}
}
1 2 3 4
void bankingAccount::recTran()
{
tran++;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
void bankingAccount::insufficent()
{
do
{
cout << "\n**There are insufficent funds in this savings account**\n"
<< "**Please deposit additions funds.**\n\n";
}
while (SAtotal <= 0);
do
{
cout << "\n**There are insufficent funds in this checking account**\n"
<< "**Please deposit additions funds.**\n\n";
}
while (CAtotal <= 0);
}