Create a c++ class called Fraction in which the objectswill represent fractions.
Remember:
  do not reduce fractions,
do not use \"const,\"
do not provide any constructors,
do not use three separate files.
You will not receive credit for the assignment if you doany of these things. In your single file, the class declarationwill come first, followed by the definitions of the class memberfunctions, followed by the client program.
It is required that you provide these memberfunctions:
A set() operation that takes two integer arguments, anumerator and a denominator, and sets the calling objectaccordingly.
Arithmetic operations that add, subtract, multiply, anddivide Fractions. These should be implemented as value returningfunctions that return a Fraction object. They should be namedaddedTo, subtract, multipliedBy, and dividedBy. In these functionsyou will need to declare a local \"Fraction\" variable, assign to itthe result of the mathematical operation, and then returnit.
A boolean operation named isEqualTo that compares twoFraction objects for equality. Since you aren't reducing yourFractions, you'll need to do this by cross-multiplying. A littlereview: if numerator1 * denominator2 equals denominator1 *numerator2, then the Fractions are equal.
An output operation named print that displays the valueof a Fraction object on the screen in the formnumerator/denominator.
-Your class has to have exactly two data members, one inorder to represent the numerator of the Fraction being represented,and the other to represent the denominator of the Fraction that isbeing represented.
Hint for how you will set up your arithmetic operationfunctions: You need 2 Fractions. One is the parameter, one is thecalling object. The function multiplies the calling object timesthe parameter and returns the result. In some ways, it is similarto the comesBefore() function from the lesson. That function alsoneeds two Fractions, and one is the calling object and one is theparameter.
When adding/ subtracting Fractions, keep in mind thatyou must first find the common denominator. The easy way to do thisis to multiply the denominators together and use that product asthe common denominator.
Use the program below. You have to copy and paste thisand use it as your client program. The output that should beproduced when the provided client program is run with your class isalso given below so that you can check your results.
I highly recommend for you to design your classincrementally. Ex: you should first implement only the set functionand the output function, and then test what you have so far. Afterthis code has been thoroughly debugged, you should add additionalmember functions, testing each one thoroughly as it is added. Youcan do this by creating your own client program to test the code ateach stage; but, it would probably be better to use the providedclient program and comment out code that relates to memberfunctions that you have not yet implemented.
As you can see from the sample output given below, youare not required to reduce Fractions or change improper Fractionsinto mixed numbers for printing. Just print it as an ImproperFraction. You are also not required to deal with negative numbers,either in the numerator or the denominator.
Here is the client program.(you may not change it orelse you will not receive credit)
#include
using namespace std;
int main()
{
    Fraction f1;
    Fraction f2;
    Fraction result;
    f1.set(9, 8);
    f2.set(2, 3);
    cout << \"The product of\";
    f1.print();
    cout << \" and\";
    f2.print();
    cout << \" is\";
    result =f1.multipliedBy(f2);
    result.print();
    cout << endl;
    cout << \"The quotient of\";
    f1.print();
    cout << \" and\";
    f2.print();
    cout << \" is\";
    result =f1.dividedBy(f2);
    result.print();
    cout << endl;
    cout << \"The sum of\";
    f1.print();
    cout << \" and\";
    f2.print();
    cout << \" is\";
    result =f1.addedTo(f2);
    result.print();
    cout << endl;
    cout << \"The difference of\";
    f1.print();
    cout << \" and\";
    f2.print();
    cout << \" is\";
    result =f1.subtract(f2);
    result.print();
    cout << endl;
    if(f1.isEqualTo(f2)){
        cout<< \"The two Fractions are equal.\" << endl;
    } else {
        cout<< \"The two Fractions are not equal.\" <
    }
}
This should be the output:
the product of 9/8 and 2/3 is 18/24
the quotient of 9/8 and 2/3 is 27/16
the sum of 9/8 and 2/3 is 43/24
the difference of 9/8 and 2/3 is 11/24
the two Fractions are not equal.