Ad
  • Default User Avatar

    Ohh, whoops. Now i get it. Thanks for explaining :)

  • Custom User Avatar

    When you took a 50 and gave back 25, your net change was 125. 3 25s and a 50.
    Then you got a 100.
    If you return 3 25s you have no more 25s left if someone gives you a 50.
    But if you return a 50 and a 25, you still got two more 25s to hand out in case you get a 50.
    Don't just count 25s, 50s are a kind of change too!

  • Default User Avatar

    It doesn't matter anything. What's the difference between giving 50&25 rather then 3 times 25? yes, maybe its not best effiency possible but its still a 75 alltogether and leaves me with no money left in the cashier. Which means I still can't give a 25 change for the last ticket.
    Lets go through the process:

    Got 25, now change=25 -> Now i got 125.
    Got 25, now change=50 -> Now I got 2
    25
    Got 25, now change=75 -> Now I got 325 || 150 & 125
    Got 25, now change=100 -> Now I got 4
    25 || 250 || 150 & 225
    Got 50, Need to pay back 25
    So now Change=75 -> Now I got 3
    25 || 150 & 125
    Got 100, Need to pay back 75
    So now Change=0 -> Now i got 0 ! No cash at all and it doesn't matter the way you pay.
    Got 50, Need to pay back 25
    Not enough change!
    expected:<[YES]> but was:<[NO]>

  • Custom User Avatar

    Your code is suboptimal.
    When you needed to pay back 75, you could have given a 50 and a 25 instead of 3 25s.
    That would leave you with 2 25s to use on further transactions.
    The correct answer is "YES".

  • Default User Avatar

    There's a problem with the tester of this kata in test 6, Java.
    I printed everything and this is what I get:

    test6(LineTests)
    Got 25, now change=25
    Got 25, now change=50
    Got 25, now change=75
    Got 25, now change=100
    Got 50, Need to pay back 25
    So now Change=75
    Got 100, Need to pay back 75
    So now Change=0
    Got 50, Need to pay back 25
    Not enough change!
    expected:<[YES]> but was:<[NO]>

    Doesn't make sense. I pass all the other 10 tests except this one. Please fix it.