Skip to content

Instantly share code, notes, and snippets.

@mjc
Created June 17, 2009 23:22
Show Gist options
  • Save mjc/131586 to your computer and use it in GitHub Desktop.
Save mjc/131586 to your computer and use it in GitHub Desktop.
//Stephen J. Dickson III
//Michael Cohen
//Mario Muriel
//Computes and displays bank service fees for commercial checking account
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
//Variable definition
const int monthlycharges = 10, lowbalance = 15;
const float firstlevel = 0.10, secondlevel = 0.08, thirdlevel = 0.06;
const float fourthlevel = 0.04;
float accountbalance = 0.0, total = 0.0;
int checks = -1, menuchoices = 0;
cout << "Bank Service Fee Calculator." << endl;
do {
cout <<"Would you like to\n";
cout <<" 1) Calculate Service Fees for another account\n";
cout <<" 2) Exit\n";
cout << "Enter your Menu choice\n";
cin >> menuchoices;
switch(menuchoices) {
case 1:
//Program code
while(checks < 0) {
cout << "Enter number of checks: \n";
cin >> checks;
}
cout << "Enter your account balance\n";
cin >> accountbalance;
if (accountbalance < 0) {
cout << "Your account is overdrawn\n";
}
total= monthlycharges;
if (accountbalance < 400) {
total += lowbalance;
}
if (checks < 20) {
total += firstlevel * checks;
}
else if(checks >= 20 && checks <= 39) {
total += secondlevel * checks;
}
else if(checks >= 40 && checks <= 59) {
total += thirdlevel * checks;
}
else if (checks>= 60 && checks <= 79) {
total += fourthlevel * checks;
}
cout << "--------------------\n";
cout << "Total fees:" << fixed << setprecision(2) << total << endl;
cout << "--------------------\n";
break;
case 2:
cout << "Goodbye!\n";
return 0;
break;
default:
cout << "Invalid choice.\n";
}
}
while (true);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment