aesa
2011-10-23 19:50:44 UTC
price = price * (1 + sales_tax_rate)
I am stuck on this one. What is wrong with variable and formula?
#include
#include
using namespace std;
int main()
{
cout << setprecision(2)
<< setiosflags(ios::fixed)
<< setiosflags(ios::showpoint);
double price, sales_tax, rate;
double total_price;
cout << " Enter the price of the item ";
cin >> price;
cout << endl;
cout << " Enter the sales tax rate as a percent(%) ";
cin >> rate;
cout << endl;
sales_tax=(rate)/100;
price=price*(1+sales_tax);
total_price = sales_tax*price;
cout << " The price of the item is " << price-total_price << endl;
cout << " The sales tax on the item is " << rate << endl;
cout << " The total price of the item is " << total_price << endl;
system("pause");
return 0;
}