Cash register ,the last challenge

can someone tell me were this value of every property in money units came from, i found these from youtube

let moneyUnits = { 'ONE HUNDRED': 10000 , 'TWENTY': 2000 , 'TEN': 1000 , 'FIVE': 500 , 'ONE': 100 , 'QUARTER': 25 , 'DIME': 10 , 'NICKEL': 5 , 'PENNY': 1 }

and another question about regex, what is the function of (" ? ") question mark alone ?

@sherwinsayo420 Well, I suppose there are units of penny, if you see the minimal unit is the penny which is numbered has “1” then ONE HUNDRED will bee 100 pennies multiplied by one hundres (100), that will be 10000 pennies, equally with the TWENTY, that will be 100 pennies multiplied by 20 that has as a result 2000 units of pennies.

1 Like

In this solution, the coder has decided to make their monetary units cents instead of dollars. This allows them to work in whole numbers and avoid problems with floating point precision.

1 Like

how about these ‘QUARTER’: 25 , ‘DIME’: 10 , ‘NICKEL’: 5 , ‘PENNY’: 1
where these value came from?

One Quarter is 25 cents, etc.

1 Like

‘QUARTER’: 25 , ‘DIME’: 10 , ‘NICKEL’: 5 , ‘PENNY’: 1 so these property value are real value ? like quarter 0.25 * 100 = 25

Yes, those are the names of units of US currency.
https://en.wikipedia.org/wiki/United_States_dollar#Coins

1 Like

thank you now i get it

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.