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

 Java Implement a data type Rational in Rational.java that represents a
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 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!