The question of money

Users who are viewing this thread

pan-boroda

Knight at Arms
Good afternoon. Question to the developers. Tell me how you did the division of money into dollars and cents? Where and in a module system that you prescribed for this?
 
I forget the specifics now, but you just have to create a helper function that splits each dollar amount into dollars and cents, and returns each in a separate variable.  Stick the values into whatever variables you need to get them out.

dollars = TRUNCATE(total amount /100)
cents = total amount %(modulus) 100

Create another function to format those values into a string, so it will be "X dollars and Y cents", but so that it will work when either value is 0.  And create another function to display those values in the $X.YY format.

Done.  But then the hardest part by far is substituting every occurance of "denars" in the module system.  Good luck!



 
Back
Top Bottom