Rational fractions are of the form a/b, where a and b are integers and b≠0. Suppose a / b and c / d are fractions. Arithmetic operations on fractions are defined by the following rules:

a/b + c/d = (ad + bc) / bd

a/b – c/d = (ad – bc) / bd

a/b x c/d = (ac)/(bd)

(a/b) / (c/d) = ad/bc, where c/d ≠0

Fractions are compared as follows:

a/b op c/d if ad op bc, where op is any of the relational operators. For example, a/b < c/d if ad < bc.

Design a class, FractionType, that performs the arithmetic and relational operations on fractions. Overload the arithmetic and relational operators so that the appropriate symbols can be used to perform the operation. Also, overload the stream insertion operator and stream extraction operator for easy input and output.

Write a C++ program that uses the FractionType class to perform operations on fractions. Note that your answers do not need to be in lowest terms.

0