Question: Given the header file fraction.h, write fraction.cpp and testFraction.cpp to test your code. testFraction.cpp should call each function: displayo, Multiply operator*0, getTop() and getBottom(). The

Given the header file fraction.h, write fraction.cpp and testFraction.cpp to test your code. testFraction.cpp should call each function: displayo, Multiply operator*0, getTop() and getBottom(). The output when you run the code should be as follows: The first fraction is 12 The second fraction is 1/5 The third fraction is 24 Hint: the definition of the display() function should show the previous output. The first fraction is created when the constructor fraction() is called. The second fraction is created when the constructor fraction(int) is called. The third fraction is created when the constructor fraction(int, int) is called. //fraction.h class fraction public: fraction(); fraction(int); fraction(int, int); void display(); fraction Multiply (const fraction &); fraction operator* (const fraction &); int getTop({return top;} int getBottom(){return bottom;} private: int top; int bottom
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
