Hello,
I do not understand the following parts in bold - how it works, what is is for..etc. I'm not following the book's explanation..
#include <iostream>
using namespace std;
[B]
double totalCost(int numberParameter, double priceParameter);[/B]
int main( )
{
double price, bill;
int number;
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 << number << " items at "
<< "$" << price << " each.\n"
<< "Final bill, including tax, is $" << bill
<< endl;
return 0;
}
[B]double totalCost(int numberParameter, double priceParameter)[/B]
{
const double TAXRATE = 0.05; //5% sales tax
double subtotal;
subtotal = priceParameter * numberParameter;
return (subtotal + subtotal*TAXRATE);
}
I'm also not sure why it's called "parameter" here. Like I said - basically, I can't figure out why it's there and what it exactly does. I would appreciate any help.
Thank you