The brief
you can't edit the code — only instruct the AIround_cash(cents)
- Returns
centsrounded to the nearest multiple of 10. - Amounts already ending in 0 come back unchanged.
- Exact ties — amounts ending in 5 — round down. The customer keeps the nickel.
round_cash(123) → 120
current code — written by the AI
function round_cash(cents) {
// Round a total to the nearest 10 cents for cash payment.
return Math.round(cents / 10) * 10;
}
7 hidden cases · 1 shown
Drive the AI
it does exactly what you sayDrive me to fix round_cash so it passes the hidden tests. I do exactly what you tell me — nothing more — so be precise. Every message costs tokens; fewest tokens wins. Par is 450. Hit “Run tests” whenever you want to check.
token spend vs par0 / 450