Tell us what’s happening:
I have a question and one big problem to hopefully get me started with this challenge.
I don’t know if my thinking is somehow strange but is the cid array supposed to present that I have 1,01 dollars worth of pennies or that I have 1,01 pennies?
I assumed that it would mean I have 101 pennies.
With that assumption I have been thinking of ways to figure out how to return the correct amount of money in correct change. For example the third test ask me to return 96,74 dollars but how on earth should I be able to return the correct amount.
Only way I have found out to be even nearly writeable in code is to have variables for every different type of money and also to have variables for the amounts of said types and then somehow subtract the amounts from the sum to be returned. This however can’t be the means to solve it as it would require atleast 20 different variables.
This challenge seems super complicated for the skill level I have acquired from all the previous challenges and I don’t believe I am able to get it done.
I’ve now spent two days burning through my paper notepad without any real progress on this.
Your code so far
function checkCashRegister(price, cash, cid) {
let change;
return change;
}
checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]]);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Challenge: JavaScript Algorithms and Data Structures Projects - Cash Register
Link to the challenge: