0

Sales Tax Help C++

Hello I need help completing this problem. a program that will compute the total sales tax on a $52 purchase. Assume the state sales tax is 7 percent and the county sales tax is 2 percent. #include <iostream> using namespace std; int main() { //declared variables double Purchase = 52.0; double StateTax = 0.07; double CountyTax = 0.02; double TotalCost = 0.0; //input section TotalCost = CountyTax * Purchase * StateTax; //processing section //output section cout << "Total Sales Tax is" << TotalCost << endl; return 0; } //end of main My results end up being 0.0728 and I feel that is not the correct answer, any other advice would be great thank you

8th Jan 2022, 5:56 PM
Gabriel Reyes
1 Réponse
0
What are you looking for: TotalTax = Purchase * (CountyTax + StateTax) Or: TotalCost = Purchase * ( 1 + CountyTax + StateTax) First one is only the total tax value. Second one is purchase plus total tax.
8th Jan 2022, 6:57 PM
Coding Cat
Coding Cat - avatar