Cash Register Project: Code works but is not passing test

Project Link:
Cash Register Project

I’ve executed my code in VS Code and get the results required for the project. When I plug it into FBC, though, its not passing the final test. The project says the following:

Test 2:
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]]);

should return {status: “OPEN”, change: [[“QUARTER”, 0.5]]}.
. . .
Test 6:
checkCashRegister(19.5, 20, [[“PENNY”, 0.5], [“NICKEL”, 0], [“DIME”, 0], [“QUARTER”, 0], [“ONE”, 0], [“FIVE”, 0], [“TEN”, 0], [“TWENTY”, 0], [“ONE HUNDRED”, 0]]);

should return {status: “CLOSED”, change: [[“PENNY”, 0.5], [“NICKEL”, 0], [“DIME”, 0], [“QUARTER”, 0], [“ONE”, 0], [“FIVE”, 0], [“TEN”, 0], [“TWENTY”, 0], [“ONE HUNDRED”, 0]]}.

I don’t understand why test 2 requires you to only return what change type is given in the array but the test 6 requires all change types, even ones that aren’t given back. This seems contradictory to me.

My code produces this for test 6:
{status:“CLOSED”, change:[[“PENNY”, 0.5]]}

Return {status: “CLOSED”, change: […]} with cash-in-drawer as the value for the key change if it is equal to the change due.

Otherwise, return {status: “OPEN”, change: […]}, with the change due in coins and bills, sorted in highest to lowest order, as the value of the change key.

If the register is open, you return the change that is being given out. If the register is closed, you give a status of the cash drawer.

Thank you…
Why that is required is still very strange to me (I guess because I come from a background of retail sales). 5 pennies is what the customer gets and does not reflect what is in the drawer (that would be $20 cash- what the customer gave). So to me what the customer gets back and what is left in the drawer are two completely separate things.

Anywho, thank you for your help :slight_smile: Project has been passed.

The customer wouldn’t get 5 pennies because they need 50 cents in change. Think of it as having to send them to another register because you don’t have enough cash in the drawer. Since you don’t have enough money you close your register and report what is in it so the manager can refill your cash drawer.

Oi, I meant 50 pennies… I’ve been staring at that problem for too long.