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.