In: Computer Science
Write in C++
Comment Steps
A bank charges $10 per month plus the following check fees for a commercial checking account:
$0.10 each for fewer than 20 checks
$0.08 each for 20 - 39 checks
$0.06 each for 40 - 59 checks
$0.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 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 overdrawn.
#include <iostream>
using namespace std;
int main(){
double balance;
int noCheques;
double chequeFee;
cout<<"Enter the initial balance : ";
cin>>balance;
if(balance<0){
cout<<"ACCOUNT IS OVERDRAWN ";
return 0;
}
cout<<"Enter the number of cheques : ";
cin>>noCheques;
balance-=10; // subtracting the monthly charges
//checking if balance comes under 400
// if comes charge $15
if(balance<400)
balance-=15;
//finding chequeFees
if(noCheques<20)
chequeFee=noCheques*0.1;
else if(noCheques>=20 && noCheques<40)
chequeFee=noCheques*0.08;
else if(noCheques>=40 && noCheques<60)
chequeFee=noCheques*0.06;
else
chequeFee=noCheques*0.04;
//subtracting the chequeFees
balance-=chequeFee;
//checking if balance comes under 400
// if comes charge $15
if(balance<400)
balance-=15;
cout<<"Chequee Fees : "<<chequeFee<<endl;
cout<<"Balance : "<<balance;
}
Note : If you like my answer please rate and help me it is very Imp for me