Extra Lab (3) - Overloading Operators - Rational Class
prelab index.html


Preparations:
Create a directory extra3 and store your program there.
In the past few weeks we have written several programs in which Rational Number Class (we called it Fraction) was used to perform some computations.  Write a new version of the Fraction program or modify one of the existing programs that you have written, so that it uses operator overloading for all the operations shown below.

In addition, overload operators:

    1)  = = ,
    2) <= ,
    3) >= ,
    4) > ,
    5) < ,
    6) - (unary operator -) , and
    7) << 

After you asked the user to enter two fractions, i.e., two pairs of integers, set the values for the two fractions,  and then ask them to enter a choice to test one of the above operators, or to test all of them, or to terminate the program.  Thus, you will have 7 choices to try the above 7 operators, one choice, choice 8, to test all of them, and anything else to terminate the program.  You are to use a switch statement for selection of choices.

There are several exmples in Chapter (8) of your textbook that you can use to write your program. Pay close attention to section 8.2. To learn more about fraction operations, see the last page of Chapter (6).