" Module: MONEY.ST Author: A. Grant Date: 20-Jan-1991 Version: 1.00-00 Modified: 20-Jan-1991 Money is a sub-class of Integer. the main differences are in the printing routines. " " | Change Log | ============================================================================ | Author Date Change " Integer variableWordSubclass: #Money instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: nil. ! Money comment: 'I implement currency. I am used instead of floating point numbers to avoid rounding errors." ! !Money methodsFor: 'conversion'! asFloat ^(self / 100.00) !! !Money methodsFor: 'printing'! printOn: aStream (self / 100.00) truncated printOn: aStream. aStream nextPut: $.. (self rem: 100) printOn: aStream. !! !Float methodsFor: 'conversion'! asMoney ^(self * 100.00) rounded !!