+ 1
Code coach kaleidoscopes.
Class, could you please explain me where the error in this code challenge. I can't event pass the 1st test case. Sololearn result is totally different from mine, event from the problem stated. Please help me. https://code.sololearn.com/cNRF1dck4Xxl/?ref=app
8 Respostas
+ 5
Unfortunately we have to pay the taxes to the government and not the other way around. The tax increases the total cost.
So change the subtraction to addition, and it will work fine.
+ 5
Only output what the example shows. Do not output any additional strings.
+ 3
totalCost = totalCost + totalCost * taxRate;
+ 2
Tax should be added to total. As already said
But Your are subtracting.
Discount apply only if quantity>1
Asked to display result round upto 2 decimal digits
0
Sure. Please look at line # 41:
totalCost = totalCost - totalCost * taxRate;
I define tax rate as final double taxRate = 0.07. the result is totally different from the sololearn calculation.
0
Oh I see, discount Will be given if the urchase quantity > 1. Thank you so much.
0
Moreover, this is purchasin tax, not revenue tax.
0
Yes, I understand.