Code.org principles Unit 7 Lesson 3 dot 6 Rounding total with tax

[My students and I are trying to round the answer with tax to display the dollar and cents .]

Link to the project or level: [(Code.org)]](Code.org)]
What I expect to happen: [display should round to the nearest 100th then add that to the total]
What actually happens: [through various iterations we have gotten the tax to display but it won’t add back to the original amount]
What I’ve tried: [function totalWithTax(amount){
var total = (amount*0.07/100)+total;
return total;
}]

Math.round function can be used for rounding in the totalWithTax function.

  1. Calculate the amount with tax: total = amount + amount * 0.07
  2. Multiply the amount with tax by 100 and use Math.round on the result: total = Math.round(total*100) to remove all the extra decimal values.
  3. Divide by 100 to get 2 decimal places: total = total /100
  4. Return total

perfection thank you so much it was a fun thought experiment but we were all getting frustrated by the end. Thank you again!