Beginner Help...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sayeda123
    New Member
    • Mar 2008
    • 1

    Beginner Help...

    I have been trying to write a program, but it isn't working! I have to calculate money in dollars, quaters, nickels, dimes and pennies. I've been working on it for more then a week and it just isn't working.
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    I'm pretty certain the problem is at line 17 of you code.


    I may be wrong of course, you could try posting it then we would know for sure.

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      I expect it's because you are using floating point (because of the handy decimal) and are suffering from rounding error.

      Finance applications shoulod use integers and you should keep your amounts in pennies.

      An integer containing 123 can always be display as $1.23 by your display function. You don't need the decimal point at all in the code until you print your data.

      Comment

      Working...