Implement a data type Rational for rational numbers that supports addition, subtraction, multiplication, and division. Use Euclid.gcd()

Question:

Implement a data type Rational for rational numbers that supports addition, subtraction, multiplication, and division.

image text in transcribed

Use Euclid.gcd() (Program 2.3.1) to ensure that the numerator and the denominator never have any common factors. Include a test client that exercises all of your methods. Do not worry about testing for integer overflow.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: