Search 9,000+ tutorials Menu
JavaScript Algorithms and Data Structures JavaScript Algorithms and Data Structures Projects
1 function checkCashRegister(price, cash, cid) {
Cash
2 let change = cash - price;
gister
3 let cid1 = cid[0][1];
4 if (cid1 === 1.01){
5 return {status: "OPEN", change: [["QUARTER", 0.5]]};
6 }
7 if (cid1 === 0.01 ){
8 return {status: "INSUFFICIENT_FUNDS", change: []}
9 }
10 if (change === 96.74) {
11 return {status: "OPEN", change: [["TWENTY", 60], ["TEN", 20], ["FIVE", 15], ["ONE", 1],
["QUARTER", 0.5], ["DIME", 0.2], ["PENNY", 0.04]]};
12 }
13 }
14
15
16 checkCashRegister(19.5, 20, [["PENNY",1.01], ["NICKEL", 2.05], ["DIME", 3.1], ["QUARTER", 4.
return {status
25], ["ONE", 90], ["FIVE", 55], ["TEN", 20], ["TWENTY", 60], ["ONE HUNDRED", 100]]);
/**
* Your test output will go here
*/