Venkata S.

asked • 02/27/15

Using Ruby Programming

Design a class Rational for fractions (n, d), d > 0 where both are relatively prime integers with gcd(n, d) = 1. Again provide constructors, accessors, mutators, to string, to double, etc. as well as methods for plus, minus, times and divide. Note that constructing a point here requires that d be non-zero so need to handle exceptions. Also to normalize n and d so that gcd = 1. Again your methods should support queries about operations on fractions, arrays of fractions - find the sum of an array, etc.

1 Expert Answer


Renan M. answered • 07/09/16

5 (2)

Software Engineer Tutor

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.