Posted by josh on Wednesday, March 10, 2010 at 7:46pm.
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!
Related Questions
Pre-Algebra - Solve the inequality for each solution. -Arnelle's checking ...
finance - computing checking account balance. based on the following information...
Algebra - Use the five steps for problem sovling. Company A charges $25 per ...
Algebra - ABC phone company charges $16 per month plus 8¢ per minute of ...
Algebra - ABC phone company charges $16 per month plus 8¢ per minute of ...
Algebra - ABC phone company charges $18 per month plus 7 cents per minute of ...
algebra - a bank has 2 checking plans. the anywhere plan charges 15 cents per ...
ALGEBRA 1 A - Would someone check my answer please? Thank you. A bank offer two ...
business - An account at a commercial bank designed for people who want to earn ...
math - On November 1,2009, Broom Company received a bank statement that showed a...
For Further Reading