I'm trying write a function that calculates cart totals. I'm crosschecking above calculation which is correct. I have a cart total which is 115.32 dollar. I apply 20 dollar fixed discount off. The sale tax is 9%. What I'm trying to find is to find the tax which is 7.87. Currently what I do is to calculate 9% of 95.32 dollar as the tax and subtract it to find subtotal - which is wrong. I need the correct formula that finds the values in the above picture. What I know is the cart total which is 115.32 dollars, I know the fixed discount amount which is 20 dollar, I know the sales tax which is 9%. By using these I have to find the subtotal ot tax amount. Any help appreciated. Thank you.
Asked
Active
Viewed 40 times
0
-
1$$87.45 \times 1.09 = 95.3205$$ – Moo Jul 05 '20 at 01:55
-
1It's not clear to me what you want. First, you say "I'm trying to find (...) the tax", and later you say "I have to find the subtotal" - so which one is it? – Matti P. Jul 06 '20 at 09:48
-
Thank you. Your answer is correct but I cannot mark is as the correct answer as in stackoverflow. – Caner Jul 06 '20 at 11:59
