Question: Program has to be split into RationalNumber.h RationalNumber.cpp and main.cpp The purpose of this lab is to practice operator overloading and friend functions. Consider the

Program has to be split into RationalNumber.h RationalNumber.cpp and main.cpp
The purpose of this lab is to practice operator overloading and friend functions. Consider the RationalNumber class declaration below. You need to write four functions A stand alone friend function that overloads the> stream extraction operator and prompts the user for rational number (numerator and denominator) class RationalNumber // Make the standalone functions friends of the RationalNumber class // private variable numerator // private variable denominator int numerator int denominator public RationalNumber( int = 0, int = I ); // default constructor I Include the prototype of the overloaded class method here You may use and complete the following main program to test your code int main( RationalNumber rl( 7, 3 ), r2(3, 9 ), r3, r4; I/ Call the overloaded subtraction operator to subtract r2 from rl // and store the result in r3 I/ Call the > overloaded operator to enter attribute values for r4 I/ Call the
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
