Need help for code!

It sounds like what you need to implement is similar to this (you can ignore the rest of the thread — much of it is about styling and unrelated stuff):

Your getTotal function will need to be different, though, as it sounds like you need to multiply and subtract rather than add.

Make sure to do all your calculations in the lowest denomination for your currency (e.g. cents rather than dollars) and then convert to the larger denomination only when displaying to the user. This is because the JavaScript Number type is floating point and therefore not perfectly accurate for fractions. Technically it’s not perfectly accurate for integers, either, but this inaccuracy is only relevant for (positive) integers above 9,007,199,254,740,991, so it isn’t typically a problem when dealing with currency.