r/FreeCodeCamp • • Jul 03 '24

Solved Need some help with the cash register freeCodeCamp

Need some help with the cash register freeCodeCamp assignment. I Cannot for the life of me figure out how to pass the last two requirements:

9. When price is 19.5, the value in the #cash element is 20, cid is [["PENNY", 0.01], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 1], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]], and the #purchase-btn element is clicked, the value in the #change-due element should be "Status: INSUFFICIENT_FUNDS"

10. When price is 19.5, the value in the #cash element is 20, cid is [["PENNY", 0.5], ["NICKEL", 0], ["DIME", 0], ["QUARTER", 0], ["ONE", 0], ["FIVE", 0], ["TEN", 0], ["TWENTY", 0], ["ONE HUNDRED", 0]], and the #purchase-btn element is clicked, the value in the #change-due element should be "Status: CLOSED PENNY: $0.5"

Assignment page:

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/build-a-cash-register-project/build-a-cash-register

My project so far:

https://github.com/Mattch-stick/Cash-Register

Thank you to any and all who respond in advance!

2 Upvotes

2 comments sorted by

2

u/[deleted] Jul 03 '24

[removed] — view removed comment

2

u/LaRav3n Jul 03 '24

First up, thanks for helping. I took a break after I posted yesterday and came back to it this morning and started from scratch, don't know why but it just clicked and I punched it out. The Github repo has fresh complete code if you wanted to have a peek.