Tell us what’s happening:
please could someone explaine the requirement of this task? Especially the last Argument (cid) of the given code.
English is not my native language and I am not an US citizen, so I dont realy understand the information in the task and this money system with Penny, Dimme, Nickel.
Sorry for that maybe stupid question.
Challenge: Cash Register
Link to the challenge:
“Nickel” or “Dime” are just names like “Dollar”, you don’t have to learn them, the challenge provides a table.
To understand what you’re supposed to do, imagine what happens when you buy a pizza.
- the pizza has a price (say, 8 dollars and a quarter = 8.25 dollars)
- you pay with a certain coin or bill (say, 10 dollar bill)
- the vendor checks his cash register to see what change he needs to return to you (does he have enough coins and bills for this)
Your function takes three arguments:
checkCashRegister(19.5, 20, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90]])
You buy something that costs
You pay with a
20 dollar bill.
The vendor needs to return
0.5 dollars, and he has:
1.01 dollars in pennies (a penny is
0.01 dollars so that’s
2.05 dollars in nickel coins (a nickel is
0.05 dollars so that’s
- and so on
He could give you 50 pennies, for example. He could also give you 2 quarters. Maybe he only has two nickels in his drawer (
2 * 0.05 = 0.10 dollars), in which case your function would return “insufficient funds”.
This is one of the tougher challenges, take your time to think it through.
Thank you for your explanation. That helps me a lot.
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.