home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
OL.LZH
/
IDOL.LZH
/
FRACTION.IOL
< prev
next >
Wrap
Text File
|
1991-07-18
|
368b
|
20 lines
class fraction(n,d)
method n()
return self.n
end
method d()
return self.d
end
method times(f)
return fraction(self.n * f$n(), self.d * f$d())
end
method asString()
return self.n||"/"||self.d
end
method asReal()
return real(self.n) / self.d
end
initially
if self.d=0 then stop("fraction: denominator=0")
end