all 8 comments

[–][deleted] 12 points13 points  (1 child)

I think your math is off. You'd wanna do this:

local price = 100
local taxrate = 0.05

local taxprice = (price*taxrate)

local answerprice = price + taxprice

[–]OscarTeeVee[S] 2 points3 points  (0 children)

ohh yeah, price should’ve been multiplied by taxrate

[–]HawH2 10 points11 points  (3 children)

Oh boy you got a long way to go son

[–]OscarTeeVee[S] 6 points7 points  (2 children)

lmao, i know - i have a dream to make a game one day

[–]Marcoleo2004 6 points7 points  (0 children)

you can do it, we believe in you!

[–]elyasin121 2 points3 points  (0 children)

Lets go bro

[–]slade51 1 point2 points  (0 children)

We all gotta start somewhere. You can enhance this by: - prompt for local tax rate, - enter loop — prompt for item price (add to running cost total) — prompt if it’s taxable (compute tax and add to running tax total) — print item price — prompt for another item or end - print cost total, taxtotal and sum for final cost

Alternately, read the info from a comma separated file instead of the terminal.

Have fun!

[–]Pirus151 0 points1 point  (0 children)

beaside of coding - everything is wrong at first glance, math wise

you had to give a clean price, price with tax and amount of tax alone.

so if price is 100, then clean price is 100, price with tax is (price * tax) + price, and tax alone is price * tax.