A bank charges $10 per month plus the following check fees for acommercial check
ID: 3627411 • Letter: A
Question
A bank charges $10 per month plus the following check fees for acommercial checking account:$.10 for each check if less than 20 checks are written
$.08 for each check if 20 through 39 checks are written
$.06 for each check if 40 through 59 checks are written
$.04 for each check if 60 or more checks are written
The bank also charges an extra $15 if the account balancefalls below $400 (before any check fees are applied). Design aclass that stores the ending balance of an account and the numberof checks written. It should also have a method that returnsthe bank's service fees for the month.
Explanation / Answer
class BankAccount
{
private:
//to store the balance
double balance;
//for number of checks written
int numOfChecksWritten;
public:
//calculates and returns the service charge for an acoount
//in a month
double serviceFees()
{
double servFees=10.0; //charge per month
//calculating check fees
//based on number of checks written
if(numOfChecksWritten >= 60)
servFees += 0.04 * numOfChecksWritten;
else if (numOfChecksWritten >=40 && numOfChecksWritten < 60)
servFees += 0.06 * numOfChecksWritten;
else if (numOfChecksWritten >= 20 && numOfChecksWritten < 40)
servFees += 0.08 * numOfChecksWritten;
else
servFees += 0.10 * numOfChecksWritten;
//if the bank balance is below $400
if(balance < 400)
servFees += 15.0;
return servFees;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.