0

C++ Sales Tax HELP

Hello I am trying to find the TotalCost but the only answer it is giving me is 0 can anyone please help??? this is for C++ by the way //C++ Program Total Sales Tax //Gabriel Reyes January 7, 2022 CIS-5 #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 cout << "Total Sales Tax is" << TotalCost << endl; //processing section TotalCost = CountyTax * Purchase * StateTax; //output section }

7th Jan 2022, 7:37 PM
Gabriel Reyes
4 Réponses
0
#include <iostream> using namespace std; int main() { //declared variables double Purchase = 0.0; double StateTax = 0.0; double CountyTax = 0.0; double TotalCost = 0.0; //input section cin>>Purchase>>StateTax >>CountyTax; //e.g 52.0>>0.07>>0.02 //processing section TotalCost = CountyTax * Purchase * StateTax; //output section cout << "Total Sales Tax is " << TotalCost << endl; } // You did cout first before doing any processing // This is the correct solution
7th Jan 2022, 7:43 PM
HK Lite
HK Lite - avatar
0
I really didnt think i would get an answer right away thank you so much!!
7th Jan 2022, 7:44 PM
Gabriel Reyes
0
would 0.0728 be the answer? I am trying to look for the total cost: 52 is cost and 0.07 and 0.02 are the tax
7th Jan 2022, 11:10 PM
Gabriel Reyes
0
I think you should add Purchase, CountyTax and StateTax instead of multiplying.
8th Jan 2022, 11:48 PM
HK Lite
HK Lite - avatar