FileDocCategorySizeDatePackage
TestRationalO.javaAPI DocExample1088Thu Nov 18 19:14:50 GMT 1999None

TestRationalO

public class TestRationalO extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

    DefaultContext dc;
    dc = Oracle.connect(new TestRationalO().getClass(),
                        "connect.properties");

    if (dc == null)
    {
       System.err.println("Can't connect!");
       return;
    }

    Integer n = new Integer(5);
    Integer d = new Integer(10);
    RationalO r = new RationalO(dc);
    r.setNumerator(n);
    r.setDenominator(d);

    Integer g = r.gcd(n, d);
    System.out.println("gcd: " + g);

    Float f = r.toreal();
    System.out.println("real value: " + f);

    RationalO s = r.plus(r); 
    System.out.println("sum: " + s.getNumerator() + "/" + 
                                 s.getDenominator());

    s = s.normalize();
    System.out.println("sum: " + s.getNumerator() + "/" + 
                                 s.getDenominator());