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
write a program that asks for the number of checks written during the past moth, then computers and displays the bank's fees for the month
in a C++
3 answers
A software company sells a package that retails for $99.Quantity discounts are given according to the following table:
#include<iostream>
#include<iomanip> // manipulator
using namespace std;
void main ()
{
bool number = true; // flag
int Nchecks; // number of ticket
float Obalance, // opening balance
Cfee, // checking fee
Cbalance; // closing balance
const float Mfee=10, // monthly fee
Exfee=15; // extra fee
cout << "Enter your beginning balance: ";
cin >> Obalance;
cout << endl << "Enter your number of check written:";
cin >> Nchecks;
cout << endl << endl << "Bank Statement" << endl<<endl;
if ( Nchecks < 0 ) // flag statement
{
number = false;
cout << "Invalid number" << endl;
cout << "Input the number greater than 0" << endl;
}
else if ( Nchecks>=0&&Nchecks< 20 ) // else if statements
Cfee = 10;
else if ( Nchecks>=20&&Nchecks<=39)
Cfee = 8;
else if ( Nchecks>=40&&Nchecks<=59)
Cfee = 6;
else if ( Nchecks>=60)
Cfee = 4;
Cbalance = Obalance + Mfee + Cfee; // calculation
if ( Obalance < 400) // case of under 400
{
if ( Nchecks>=0&&Nchecks< 20 )
Cfee = 10;
else if ( Nchecks>=20&&Nchecks<=39)
Cfee = 8;
else if ( Nchecks>=40&&Nchecks<=59)
Cfee = 6;
else if ( Nchecks>=60)
Cfee = 4;
Cbalance=Obalance + Mfee + Cfee + Exfee;
}
if ( number ) // for true flag
{
cout<<setprecision(2)<<setiosflags(ios::fixed|ios::showpoint);
cout<<"Opening Balance:"<<setw(14)<<"$"<<setw(10)<<Obalance<< endl;
cout<<"Monthly Fee:"<<setw(18)<<"$"<<setw(10)<<Mfee<<endl;
cout<<"Checking Fee:"<<setw(17)<<"$"<<setw(10)<<Cfee<<endl;
cout<<"Closing Balance:"<<setw(14)<<"$"<<setw(10)<<Cbalance<<endl;
}
}
here is one way hope it helps!
#include<iomanip> // manipulator
using namespace std;
void main ()
{
bool number = true; // flag
int Nchecks; // number of ticket
float Obalance, // opening balance
Cfee, // checking fee
Cbalance; // closing balance
const float Mfee=10, // monthly fee
Exfee=15; // extra fee
cout << "Enter your beginning balance: ";
cin >> Obalance;
cout << endl << "Enter your number of check written:";
cin >> Nchecks;
cout << endl << endl << "Bank Statement" << endl<<endl;
if ( Nchecks < 0 ) // flag statement
{
number = false;
cout << "Invalid number" << endl;
cout << "Input the number greater than 0" << endl;
}
else if ( Nchecks>=0&&Nchecks< 20 ) // else if statements
Cfee = 10;
else if ( Nchecks>=20&&Nchecks<=39)
Cfee = 8;
else if ( Nchecks>=40&&Nchecks<=59)
Cfee = 6;
else if ( Nchecks>=60)
Cfee = 4;
Cbalance = Obalance + Mfee + Cfee; // calculation
if ( Obalance < 400) // case of under 400
{
if ( Nchecks>=0&&Nchecks< 20 )
Cfee = 10;
else if ( Nchecks>=20&&Nchecks<=39)
Cfee = 8;
else if ( Nchecks>=40&&Nchecks<=59)
Cfee = 6;
else if ( Nchecks>=60)
Cfee = 4;
Cbalance=Obalance + Mfee + Cfee + Exfee;
}
if ( number ) // for true flag
{
cout<<setprecision(2)<<setiosflags(ios::fixed|ios::showpoint);
cout<<"Opening Balance:"<<setw(14)<<"$"<<setw(10)<<Obalance<< endl;
cout<<"Monthly Fee:"<<setw(18)<<"$"<<setw(10)<<Mfee<<endl;
cout<<"Checking Fee:"<<setw(17)<<"$"<<setw(10)<<Cfee<<endl;
cout<<"Closing Balance:"<<setw(14)<<"$"<<setw(10)<<Cbalance<<endl;
}
}
here is one way hope it helps!
#include <iostream>
using namespace std;
int main()
{
double checks;
int monthBankCharge = 10;
cout << "Enter the amount of checks you've written in the past month\n";
cin >> checks;
if (checks < 20)
{ cout << checks * 0.10 << endl;}
else if (checks >= 20)
{ cout << checks* 0.08 << endl;}
else if (checks >= 40)
{ cout << checks * 0.06 << endl;}
else if (checks >= 60)
{ cout << checks * 0.04 << endl;}
system("pause");
return 0;
using namespace std;
int main()
{
double checks;
int monthBankCharge = 10;
cout << "Enter the amount of checks you've written in the past month\n";
cin >> checks;
if (checks < 20)
{ cout << checks * 0.10 << endl;}
else if (checks >= 20)
{ cout << checks* 0.08 << endl;}
else if (checks >= 40)
{ cout << checks * 0.06 << endl;}
else if (checks >= 60)
{ cout << checks * 0.04 << endl;}
system("pause");
return 0;