home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
historic
/
v941.tgz
/
icon.v941src.tar
/
icon.v941src
/
ipl
/
packs
/
idol
/
fraction.iol
< prev
next >
Wrap
Text File
|
2000-07-29
|
349b
|
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