Ad
  • Default User Avatar

    You are right...

  • Default User Avatar

    Ok,make an item list which can be used.

  • Default User Avatar

    Ok,sloved!

  • Custom User Avatar

    The price per item should be ... and less than money provided to the machine

    It should be not more than, because it's allowed for the two to be equal (and the tests expected this as well).

  • Custom User Avatar

    What kind of coins are involved? It's not mentioned anywhere at all.

  • Custom User Avatar

    This kata is no different from https://www.codewars.com/kata/making-change except for the formatting.

  • Custom User Avatar

    I think it's ok now - haven't looked for details, but 4 random tests should be enough (perhaps next time it's better to use a loop for more tests and shorter code), so thanks for the work;-)

  • Custom User Avatar

    Thanks for the tip! I have added a few random tests, please let me know what you think, also I have changed some of the input validation stuff around from another user's critcism that it was a bit confusing.

  • Custom User Avatar

    @Kaiyou

    I change the wording to be more clear, and took away the "Assume" part so it's clear you need to check for the input to be correct. Let me know what you think.

  • Custom User Avatar

    @ben8p:

    I am also very very very very very very very very confused! I'm not sure the last example test case is pointing me to the correct solution, it seems to suggest that you would need to structure the calls the way I expect but not with 8 method calls with blank input, and then 3 method calls with non blank input.

    Edit: your example shows up now, it was hidden before i commented!

  • Custom User Avatar

    Hi chuckmag, that's the usual way to implement these final testcases. For solved katas you can see code examples if you click/look at "Show Kata Test Cases" (open a solved kata and you will see this "link" in the middle of the site). There you will find what others do and surely there are some examples with random tests too - probably it's the easiest way to find out what to do exactly;-)!

  • Custom User Avatar

    Hi smile67, I get your point with this solution that some Random Test Cases would help make this Kata better. I was thinking about how to implement that and the best i could come up with is actually having the correct implementation in the Test Class so that I can run that Random Test inputs through the correct solution and compare it to the user's. Is that the best way you might implement random test cases?

  • Custom User Avatar

    That's fair criticism. I agree that your wording is less confusing and actually the suggestion to make it more like what a Vending Machine would do is even better. I'll consider adding that and updating the kata!

    Thanks for your feedback.

  • Default User Avatar

    I didn't really get from the description, that the user can input more money and that I have to protect against that. Maybe change

    and that the user will not provide more than $1.00 to the vending machine.

    to

    and the user could provide more than $1.00, but you shouldn't allow that and return "No Change." in this case

    ..also, wouldn't it be better to just return the users money? This way the machine eats the money, which isn't something a machine is supposed to do,...

  • Custom User Avatar

    Just took a look at your solution and I haven't tested it, but maybe your inputMoney > 1 should be inputMoney > 1m. I think if you were doing this in visual studio you'd probably get warnings about that.

  • Loading more items...