Program to print the total price and the tax payable as output
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
double tax_rate = 0.00, price = 0.00, total_price =
0.00, tax_payable = 0.00;
int counter = 0;
cout
<< "\n\n\t\t\t__ Tax Payable Problem
__";
cout
<< "\n\n Enter the Tax rate (in %) -
";
cin
>> tax_rate;
cout
<< "\n\n Enter the price -> ";
for(counter = 1; counter <= 5; counter++)
{
cout
<< "\n\n
" << counter << "
Item - $ ";
cin
>> price;
total_price
= total_price + price;
}
tax_payable
= (tax_rate * total_price) / 100;
cout
<< "\n\n\t\tTotal Price -> $ "
<< total_price << "\t Tax Payable
-> $ " << tax_payable;
cout
<< "\n\n\t\tNet Total Price -> $
" << total_price + tax_payable;
getch();
return 0;
}
Program reads in a tax rate (as a percentage) and the
prices of five items,then it calculates the total price, before tax,
of the items, then the tax payable on those items.
The tax payable is
calculated by applying the tax rate percentage to the total price and at last the
total price and the tax payable are printed as output with net total price.
No comments:
Post a Comment