Ad
  • Custom User Avatar

    I didn't know you can put a function there! So cool.
    Elegant solution.

  • Default User Avatar

    The testcase Test.assertEquals(splitTheBill(100, 2, 2), 50,); should be Test.assertEquals(splitTheBill(100, 2, 2), 50);, without the , after 50.

  • Custom User Avatar

    Add some edge cases tests.
    Add random tests.

  • Custom User Avatar

    I'm new to this - can you let me know how you think they should be improved? Thanks!

  • Custom User Avatar

    Thank you for pointing this out! It should be 'round' and I will amend it shortly.

  • Custom User Avatar

    poor tests

  • Custom User Avatar

    Keep the values to 2 decimal places.

    How to keep 2 decimal places? round, floor, or ceil?

    I used ceil, because in testcase1:

    splitTheBill(100, 2, 1), '45.45,54.54'
    

    I got two decimal numbers:

    45.45454545454545 54.54545454545454
    

    But I failed at testcase3:

    Test.assertEquals(splitTheBill(59, 4, 1), '14.05,16.86');
    

    I got two decimal numbers:

    14.047619047619047 16.857142857142858
    
    Expected: '14.05,16.86', instead got: '14.04,16.85'