//Cameron Pham CS1A Chapter 4, P. 222, #12
//
/*******************************************************************************
*
* Calculate Bank Service Fees
* ______________________________________________________________________________
* This program accepts values for a beginning account balance and the number
* of checks written. It then calculates the bank's monthly service fees based
* on the given information.
* ______________________________________________________________________________
* INPUT
* Beginning balance
* Number of checks written
* Check fees
* Service fees
*
* OUTPUT
* Total bank service fees for the month
*******************************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
int main() {
double beginningBalance;
int checks;
double checkFee;
double serviceFee;
cout << "Enter the beginning balance\n";
cin >> beginningBalance;
cout << "You entered: $" << beginningBalance << endl;
// Check for negative beginning balance
if (beginningBalance < 0)
{
cout << "URGENT: The account is overdrawn!" << endl;
return 0;
}
cout << "Enter the number of checks written\n";
cin >> checks;
cout << "You entered: " << checks << " checks" << endl;
// Check for negative number of checks
if (checks < 0)
{
cout << "ERROR: The number of checks cannot be negative." << endl;
return 0;
}
// Determine the check fee
if (checks < 20)
{
checkFee = 0.10;
}
else if (checks <= 39)
{
checkFee = 0.08;
}
else if (checks <= 59)
{
checkFee = 0.06;
}
else
{
checkFee = 0.04;
}
// Calculate monthly service fee
serviceFee = 10.00 + (checks * checkFee);
// Add $15 fee if balance is below $400
if (beginningBalance < 400)
{
serviceFee += 15.00;
}
cout << fixed << setprecision(2);
cout << "Bank service fees for the month: $" << serviceFee << endl;
return 0;
}