#include <iostream>
using namespace std;
double totalCost(int
numberParameter, double priceParameter);
//Computes the total cost, including 5% sales tax,
//on numberPar items at a cost of pricePar each.
int main( )
{
double price, bill;
int number;
cout << endl;
cout << "Enter the number of items purchased:
";
cin >> number;
cout << "Enter the price per item $";
cin >> price;
bill =
totalCost(number, price);
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout << endl;
cout << number << " items at "
<< "$" <<
price << " each.\n"
<< "Final bill,
including tax, is $" << bill
<< endl <<
endl;
return 0;
}
double totalCost(int
numberParameter, double priceParameter)
{
const double
TAXRATE = 0.05; //5% sales tax
double
subtotal;
subtotal =
priceParameter * numberParameter;
return
(subtotal + subtotal*TAXRATE);
}