-- rational numbers test for Eiffel class RATS creation make -- make here is both constructor and main feature { NONE } make is local r1 : RATIONAL; r2 : RATIONAL; do !!r1.make(1,2); -- special form for calling constructor (!! is "new") !!r2.make(3,6); r1.printrat; io.put_string("%N"); -- %N is \n r2.printrat; io.put_string("%N"); if (r1.rateq(r2)) then io.put_string("they're equal %N"); else io.put_string("they're not equal %N"); end; -- if end; -- make/main end -- end RATS -- To run this program on Hofstra CS Solaris systems, -- First add the following environment bindings (add them to .cshrc): -- setenv PATH /shared/csc/local/SmallEiffel/bin:$PATH -- setenv SmallEiffel /shared/csc/local/SmallEiffel/sys/system.se -- Save this file with as rats.e (filename is important) -- Save rational.e as well (can't have >1 class in a file) -- type "compile rats.e" -- Produced executable is a.out - run it with ./a.out -- NOTE: -- the name of the class must be capitalized, but file name is lower case!