Create a class called Rational
for performing
arithmetic with fractions. Your code should include
print()
that prints a rational numberYou may use overloaded operators if you desire. Additionally, your code should always store rational numbers in reduced form (e.g. 2/4 should become 1/2).
After this (shouldn't be hard), you get some experience with another sorting algorithm: bucket sort. Bucket sort is described in problem 4.30 of Deitel, page 317. Rather than doing bucket sort on integers, do a bucket sort on rational numbers, using your class from the first problem.