Need help for code!

Hey! I’m taking an online class on webdesign, and having some trouble with a JavaScript assignment. If anyone could send some tips my way it’d be greatly appreciated!

I’m creating a travel agency order form (without PHP) where several of the inputs need to be calculated together at the bottom. The fields are: amount of days, amount of travelers, type of room (has different prices), and a member discount selection box where a code is required to get the discount. These need to be summed up somehow. I’m in way over my head, so if anyone has some pointers let me know!

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.