Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 theStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started