# calculating monthly bank fees

• 10-04-2010
helloalyssa
calculating monthly bank fees
hi everyone! i almost have my program finished (pretty surprised i actually do lol) but i'm having a couple problems. this is what the program should do (copied straight out of the textbook)

a bank charges \$10 per month plus the following check fees for a commercial checking account:

\$.10 for less than 20 checks
\$.08 each for 20-39 checks
\$.06 each for 40-59 checks
\$.04 each for 60 or more checks.

the bank also charges an extra \$15 if the balance of the account falls below \$400 (before any check fees are applied.) write a program that asks for the the beginning balance and the number of checks written. compute and display the bank's service fees for the month.

input validation: do not accept a negative value for the number of checks written. if a negative value is given for the beginning balance, display an urgent message indicating the account is over drawn.

i'm having a problem with adding the initial \$15 if the balance is under \$400 and displaying the message if the balance is negative.

here is the code i have for this part of the program:
Code:

``` // Calculate bank fees based on amount of checks user inputs.   // if (balance <= 400)   //  fee = 15 + (   if (checks < 20)     fee = checks * .10;   else if (checks < 39)     fee = checks * .08;   else if (checks < 59)     fee = checks * .06;   else if (checks >= 60)     fee = checks * .04;   else if (checks <= 0)   {     cout << "Your account is overdrawn! \n";     cout << "Number of checks must be zero or more. \n";   }```

the first three lines are commented out because i know they're wrong from trying to run the program. could anyone help me out by giving me some possible suggestions?? thank you :)
• 10-04-2010
Elysia
So you've got the condition semi-right (it should be below 400, the text says):

// if (balance <= 400)

Now, all you need to do is add 15 to the fee. That's what it says. Considering you've managed to calculate the fee from the checks, this should be trivial. What are you having problems with?
• 10-04-2010
helloalyssa
do i have add 15 to the fee to the line below // if (balance <= 400) or else if (checks <= 0)?? i'm sorry if this is a dumb question but it's these little problems that really confuse me.
• 10-04-2010
Elysia
Well, you wrote the code, so you must know for what reason you added the two if statements, right?
If you think this through: imagine placing that under the first if statement, then run a simulation in your mind. Say balance is < 400 and you a number of checks, say, 10. What will happen? Then do the same when it's under the last if statement.

Which one makes sense?