Test Case Explanation -Cash Register project

Can anyone explain following test case Of Cash Register Project

checkCashRegister(3.26, 100, [["PENNY", 1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]])` should return  `{status: "OPEN", change: [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1], ["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]}` .


**Your browser information:**

User Agent is: `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36`.

**Link to the challenge:**
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/javascript-algorithms-and-data-structures-projects/cash-register

What part is confusing you?

i am not getting how "change" key value pair is returned means on what basis

When you purchase something and pay more than the required amount, you get the difference back. This is called “change”.
For example: if you want to buy something that costs $1.50 and you hand over two $1 bills, then you will get 50 cents in change.

the purchase is 3.26, the customer gives 100 in cash. It means that the customer should get back 96.74$
the change is calculated based on the value the customer should get back and the physical cash in the drawer
so the customer is gonna get back 60$ in 20$ bills, 20$ in 10$ bills, 15$ in 5$ bills, 1$ in 1$ bills, 0.5$ in quarters, 0.2$ in dimes and 0.04$ in pennies

1 Like
Thank you @ieahleen for explanation