Ad
  • Custom User Avatar

    Same here! Yours looks more elegant than mine. I used a for loop to creates the string! oops

  • Custom User Avatar

    Omg, i used Insert too, thank you :D

  • Default User Avatar

    You're right, man. In this kata, instead of learning programming, we learn to pass tests

  • Default User Avatar

    thank you, if it wasn't for your comment, I'd have given up on this kata!

  • Default User Avatar

    Although the kata is interesting and challenging, it brings a lot of frustration at the end. I've spent almost as much time passing the tests as I've done writing the code, just because some things were not clear from the task formulation.

    1. Examples and sample tests imply that all money values are formatted xxx.xx (e.g 14.32). Only when taking random tests one realises, that this is not the case: sometimes they are xx.x and sometimes even integers. I think that such possibilities should be explicitly stated when formulating the task.

    2. It's really easy not to see that TWO spaces are required after "Total expense" and "Average expense". Maybe give an extra hint?

    3. The "\n" and "\r\n" thing is confusing. When I'm using "r\n" in my own environment it produces extra blank lines that are clearly not needed, but you can't pass the tests when using "\n".

  • Default User Avatar

    my result in visual studio
    Original Balance: 1000.00
    125 Market 125.45 Balance 874.55
    126 Hardware 34.95 Balance 839.60
    127 Video 7.45 Balance 832.15
    128 Book 14.32 Balance 817.83
    129 Gasoline 16.10 Balance 801.73
    Total expense 198.27
    Average expense 39.65

  • Default User Avatar

    How then to explain the fact that in visual studio I get the necessary output?

  • Default User Avatar

    In "125 Market 125.45 Balance 87455" 87455 "seems" to be an int (in a string, OK) when 874.55 is expected.
    BTW no need to be unpleasant, that will bring nothing:-) I simply try to show you where there is a problem!

  • Default User Avatar

    And hello, mr.GEniuses who always sure of his code.
    Pay attention to the line of the average price. There is a number with a dot.

  • Default User Avatar

    How can you say that I return int when string is returned?

  • Default User Avatar

    Not an issue of the kata but of your code. Uou are returning int, ex:

    125 Market 125.45 Balance 87455
    and so on...
    instead of
    125 Market 125.45 Balance 874.55
    ...
    
    

    Don't post issue unless you are absolutely sure of your code...

  • Default User Avatar

    when compiling in Visual Studio I get the correct answer with 2 decimal places. And here I get the output like this:

    Original Balance: 1000.00
    125 Market 125.45 Balance 87455
    126 Hardware 34.95 Balance 83960
    127 Video 7.45 Balance 83215
    128 Book 14.32 Balance 81783
    129 Gasoline 16.10 Balance 80173
    Total expense 19827
    Average expense 3965.4

    I tried both Math.Round, and String.Format and ToString ("#. ##") nothing works.