View Single Post
Old 02-17-2008, 02:08 PM   #9 (permalink)
jaeusm
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default Re: C# Ideas - Working With Coins & Bills

The algorithm I specified above is just that -- an algorithm. The implementation details are left to you. You need to cast double values to ints and use the Math.Round() function once in the implementation of my algorithm. You do not need to use the Convert() function. Just use a simple cast. I think the algorithm you're using is a bit convoluted, but if it works and you understand what it's doing then it will serve your purpose.

To clean up what you have, you need to move similar logic into a single method. Anytime you're copying/pasting code or writing several blocks of code that does the same thing repeatedly, you need to move it into a method and just call that method repeatedly.
jaeusm is offline