1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
|
#include <iostream>
#include <iomanip>
using namespace std;
#define CHECK_FEE = 5.00
#define PERT_INT_RATE = .05
int main()
{
string C, c, S, s, B, b, M, m, W, w, D, d;
int CheckDep, CheckWithd, SavDep, SavWithd, option, password, makechange, SavOpt, CheckOpt, IntRate, TransAns;
float checking = 0, savings = 0;
// display main screen options
do
{
cout << endl << endl
<< "***** ACME Bank ATM *****" << endl
<< "\nBanking Options" << endl << endl
<< "C)hecking Account" << endl << endl
<< "S)avings Account" << endl <<endl
<< "B)alance Display" << endl <<endl
<< "M)onthly Maintenance" << endl << endl;
// get user to pick an option
// display additional options for the customer to choose from
cout << "What would you like to do? ";
cin >> option;
//find out if customer wants to make a withdrawl or deposit to
// their checking account
if (option == 'c' || option == 'c')
{
cout << "W)ithdrawl or D)eposit? " << endl;
cin >> CheckOpt;
//if customer wants to withdrawl, have them enter an amount. If
// customer deposits money, calculate new balance.
if (CheckOpt == 'w' || CheckOpt == 'W')
{
cout << "Enter the amount to withdrawl from checkings: ";
cin >> CheckWithd;
//if withdrawl leaves positive balance, adjust balance. if not, dispaly
// an error message
if (checking - CheckWithd > 0)
{
checking = checking - CheckWithd;
}
else
{
cout << endl << endl
<< "The requested amount ( " << CheckWithd << " ) exceeds the balance " << endl
<< "( " << checking << " ) of your account. Please deposit more funds or try " <<endl
<< "a smaller withdrawl " << endl;
}
// if customer wants to make a deposit, get the amount and add it to balance
if (CheckOpt == 'd' || CheckOpt == 'D')
{
cout << "Enter the amount to depostit to checking: ";
cin >> CheckDep;
checking = checking + CheckDep;
}
}
//find out if customer wants to withdrawl or deposit money in savings
else if (option == 's' || option == 'S')
{
cout << "W)ithdrawl or D)eposit? " << endl;
cin >> SavOpt;
//if customer wants to withdrawl, have them enter an amount. If
// customer deposits money, calculate new balance.
if (SavOpt == 'w' || SavOpt == 'W')
{
cout << "Enter the amount to withdrawl from savings: ";
cin >> SavWithd;
//if withdrawl leaves positive balance, adjust balance. if not, dispaly
// an error message
if (savings - SavWithd > 0)
{
savings = savings - SavWithd;
}
else
{
cout << endl << endl
<< "The requested amount ( " << SavWithd << " ) exceeds the balance " << endl
<< "( " << savings << " ) of your account. Please deposit more funds or try " <<endl
<< "a smaller withdrawl " << endl;
}
// if customer wants to make a deposit, get the amount and add it to balance
if (SavOpt == 'd' || SavOpt == 'D')
{
cout << "Enter the amount to depostit to checking: ";
cin >> SavDep;
savings = savings + SavDep;
}
}
//if customer chooses the balance option, display the checking and savings balance
else if (option == 'b' || option == 'B')
{
cout << "Checking Account Balance: " << checking << fixed << setprecision(2) << endl;
cout << "Savings Account Balance: " << savings << fixed << setprecision(2) << endl;
}
//if customer chooses account maintance, have them enter password
else if (option == 'm' || option == 'M')
{
cout << "Enter the account password: " << endl;
cin >> password;
//display the checking fees, interest rates, and acoount balances
if (password = makechange)
{
checking = checking - CHECK_FEE;
IntRate = (savings * PERT_INT_RATE) / 12;
savings = savings + PERT_INT_RATE;
cout << "Checking Fee: " << CHECK_FEE << endl;
cout << "Checking Account Balance: " << checking << endl;
cout << "Interest at 5% annual: " << IntRate << endl;
cout << "Savings Account Balance: " << savings << endl;
}
else
{
cout << "Invalid Password! ";
}
}
//ask customer if they want another transaction
cout << "\n\nDo you want another transaction? (y/n) " << endl;
cin >> TransAns;
while (TransAns == 'y' || TransAns == 'Y');
{
cout << "Thank You for using ACME Bank ATM!";
}
}
return 0;
}
|