The constructor you have defined, takes 2 int
s as arguments.
public Rational(int x, int y) {
num = BigInteger.valueOf(x);
den = BigInteger.valueOf(y);
}
and the compiler complains because you are passing two BigIntegers
.
Have a new overloaded Constructor
public Rational(BigInteger x, BigInteger y) {
num = x;
den = y;
}