Question: Java Implement a data type Rational in Rational.java that represents a rational number, i.e., a number of the form a/b where a and b notequalto
Implement a data type Rational in Rational.java that represents a rational number, i.e., a number of the form a/b where a and b notequalto 0 are integers. The data type must support the following API: public class Rational Rational(long x) Rational(long x, long y) Rational add(Rational that) Rational multiply(Rational that) private static long gcd(long p, long q) String toString() Rational(long x, long y)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
