Ad
  • Default User Avatar

    The reason is that 0.9 times the total sum results in a 10% deduction from the aforementioned sum.

  • Default User Avatar

    This is probably a level 7 kata I think. Also some solutions use 0.9 for percent, when 10 (0.1) is asked for. Is there a reason for this?

  • Custom User Avatar

    All border cases should be tested, 2, 4, 8 and 10 litres in fixed tests in all languages.

  • Custom User Avatar

    Not a kata issue, one of your conditions is wrong:

    Purchases of 2 or more litres get a discount of 5 cents per litre

    You're doing a 50 cents discount. And because border cases aren't tested your code passed.

  • Custom User Avatar

    Nothing is broken, your switch conditions are wrong:

    Purchases of 2 or more litres get a discount of 5 cents per litre...

    so I know im getting the discount correct

    No, you're not, see the second sample test, print discount value.

  • Default User Avatar

    Yeah this is broken, especially for a level 8 kata
    The formula is simple. I am using pattern matching without any fancy stuff, so I know im getting the discount correct
    I can't pass all the tests, tweak the rounding and one test passes another failes, tweak it again and different tests pass/fail

  • Default User Avatar

    Hey @yogabija - I just solved this kata to answer your query, and I had the same error as you.

    It turns out that in the description, there is this line:

    "However, let's also include 10% wiggle room (deducted from the candidate's minimum salary) in case the candidate is a rockstar who enjoys programming on Codewars in their spare time."

    This "10% wiggle room" means, for non-native speakers, that the developer will accept to lower/reduce his salary by up to 10% of its amount. So, if his given Minimum Salary is $200, then his "Real" Minimum Salary is actually $200 - 10% = $180.

    I hope this helps a bit (I agree with you that the description/kata is a bit confusing)

  • Default User Avatar

    Okay this test I think is broken!

    Candidate: 190000
    Job: 171000

    Test Failed
    Expected: True
    But was: False

  • Default User Avatar

    Also one of the tests which fails should not be failing because the test is wrong/