Modify the rational number class. Represent rational numbers as two values of type int,
one for the numerator and one for the denominator.
Include a constructor with two arguments that can be used to set the member variables of
an object to any legitimate values. Also include a constructor that has only a single parameter
of type int; call this single parameter whole_number and define the constructor so that
the object will be initialized to the rational number whole_number/1. Also include a
default constructor that initializes an object to 0 (that is, to 0/1).
Overload the input and output operators >> and <<. Numbers are to be input and output in the form 1/2, 15/32, 300/401, and so forth. Note that the numerator, the denominator, or both may contain a minus sign, so -1/2, 15/32, and -300/-401 are also possible inputs. Overload all of the following operators so that they correctly apply to the type Rational: ==, <, <=, >, >=, +, -, *, and /. Also overload the unary -.
Use the same formulas as assignment 8 for defining the overloaded operators. Makes use of
the examples of lecture 20 for the << and >> overloading operators overloading. The Boolean
overloaded operators should return a bool value.
Provide a main function that thoroughly tests your class implementation. Create two
objects (each representing a rational number). Test the two objects with each of the
overloaded functions. Also test the operators with a combination of integers and objects.

New Download