You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your solution should not use the Array.prototype.flat() or Array.prototype.flatMap() methods.
874
874
875
+
```
876
+
877
+
878
+
## Cash Register
879
+
880
+
Design a cash register drawer function checkCashRegister() that accepts purchase price as the first argument (price), payment as the second argument (cash), and cash-in-drawer (cid) as the third argument.
881
+
882
+
cid is a 2D array listing available currency.
883
+
884
+
The checkCashRegister() function should always return an object with a status key and a change key.
885
+
886
+
Return {status: "INSUFFICIENT_FUNDS", change: []} if cash-in-drawer is less than the change due, or if you cannot return the exact change.
887
+
888
+
Return {status: "CLOSED", change: [...]} with cash-in-drawer as the value for the key change if it is equal to the change due.
889
+
890
+
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.
0 commit comments