Getting Mathematical Errors Trying to calculate base price of gas
Getting Mathematical Errors Trying to calculate base price of gas I am trying to solve a problem that requires me to write code to find the base price of a gallon of gas. I am provided with the cost of a gallon of gas, the amount of federal and state tax, and the percent for sales tax. I've tried formatting the equation a couple different ways and the math is always wrong. This is the closest I've gotten (the output is $3.289 which is only .073 cents off, which when I do the calculations by hand happens to be the amount of sales tax so it is as if it is ignoring the end of the equation completely). Could I please get some assistance? I've included the entire problem I was given below. double pumpPrice=3.89, fedTax=.184, stateTax=.417, salesTax=2.25; double basePrice, totalTax, percentTax, profit_bigOil ; basePrice = pumpPrice-fedTax-stateTax-((salesTax*basePrice)/100) ; cout <<"The base price for a gallon of gas is $" <<basePrice << endl; Create ...