Hello Scratch forums!
Just a quick question -
I can't figure out how to add tax to my total cost of pizza. Here is my calculation:
Cost of pizza* ($10.00) + Cost of toppings* ($2.50) and then the two taxes: PST and GST (Now known as the "HST") PST = 8% and GST = 6%.
Whenever I add them all up on Scratch; I get 0.1.
Can anyone help?
Thanks!
Offline
I would recommend something like this:
That works out to $14.30, which seems accurate.
Offline
hmnwilson wrote:
I would recommend something like this:
That works out to $14.30, which seems accurate.
Thanks hmnwilson; although it seems that it won't set the varibles to the correct value :?.
I need help ASAP.
Thanks!!!!!
Offline
lolzmaster wrote:
hmnwilson wrote:
I would recommend something like this:
That works out to $14.30, which seems accurate.Thanks hmnwilson; although it seems that it won't set the varibles to the correct value :?.
I need help ASAP.
Thanks!!!!!
If you have "Cost of pizza" and "Cost of toppings" set correctly, it should work. Or are you talking about something else?
Offline
Unfortunatally; it doesn't. The only answer I get is 0.0; which; obvusally; is incorrect. It sets the tax to 0.0 (both of them).
Thanks for your help hmnwilson; VERY helpful!
Offline
lolzmaster wrote:
Unfortunatally; it doesn't. The only answer I get is 0.0; which; obvusally; is incorrect. It sets the tax to 0.0 (both of them).
Thanks for your help hmnwilson; VERY helpful!
I think it's because Scratch automatically rounds to tenths, and you need hundredths...

Offline
lolzmaster wrote:
Unfortunatally; it doesn't. The only answer I get is 0.0; which; obvusally; is incorrect. It sets the tax to 0.0 (both of them).
Hmm, that's weird...
This may be a long shot, but you're not putting a dollar sign ($) in front of the number, are you? You may be tricking Scratch into thinking it's a string, which will automatically return 0 if used with the math blocks. When you're doing math using variables, they should only contain the numbers 0-9, a period, or a comma (for decimals).
In any case, I've uploaded a project here which you can compare with your scripts. Make sure when you enter the values, don't include the dollar sign.
Offline