In c++ format please
Bank Charges
A bank charges $10 per month plus the following check fees for a
commercial checking account:
$.10 each for fewer 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 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.
Sample Output:
Enter the following information about your checking account. Beginning balance: $500000 Number of checks written: -8 Number of checks must be zero or more. Enter the following information about your checking account. Beginning balance: $20000 Number of checks written: 25 The bank fee this month is $12.00 Enter the following information about your checking account. Beginning balance: $1000 Number of checks written: 5 The bank fee this month is $10.50
Source Code:
Output:
Code in text format (See above images of code for indentation):
#include<iostream>
#include<iomanip>
using namespace std;
/*main function*/
int main()
{
/*variables*/
double balance,fee=10;
int checks;
/*read beginning balance*/
cout<<"Enter the following information about
your checking account.\n";
cout<<"Beginning balance: $";
cin>>balance;
/*read number of checks from user*/
cout<<"Number of checks written: ";
cin>>checks;
/*if balance is negative*/
if(balance<0)
cout<<"Your account is
account is overdrawn!";
/*if checks are negative*/
else if(checks<0)
cout<<"Number of checks must
be zero or more.";
else
{
/*if balance is lessthan 400 add
extra 15*/
if(balance<400)
fee+=15;
/*check for particular condition
and calculate fee*/
if(checks<20)
fee+=(checks*0.10);
else if(checks>=20 &&
checks<40)
fee+=(checks*0.08);
else if(checks>=40 &&
checks<60)
fee+=(checks*0.06);
else
fee+=(checks*0.04);
cout<<fixed<<setprecision(2);
/*print fee*/
cout<<"The bank fee this
month is $"<<fee;
}
}
Get Answers For Free
Most questions answered within 1 hours.