Assignment: Instructions: Consider the RationalNumber class declaration below. You need to write four functions:…

Instructions: Consider the RationalNumber class declaration below. You need to write four functions: – A stand alone friend function that overloads the << operator and prints a rational number in the form numerator/denominator. – A member function that overloads the subtraction operator (-) for the RationalNumber class. The member function subtracts two RationalNumber objects r1 and r2 and assigns the result to object r3. – A standalone friend function that overloads fix increment operator (++) for the RationalNumber class. The friend function adds one to a RationalNumber object and allows cascaded function calls. – 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: int numerator; // private variable numerator int denominator; // private variable denominator public: RationalNumber( int = 0, int = 1 ); // default constructor // 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 r1( 7, 3 ), r2( 3, 9 ), r3, r4; // Call the overloaded subtraction operator to subtract r2 from r1 // and store the result in r3 // Call the << overloaded operator to display the rational number r3, and then display r1 // Call the overloaded postfix increment to increment r1 and store it in r3 // Call the << overloaded operator to display the rational number r3 // Call the >> overloaded operator to enter attribute values for r4 // Call the << overloaded operator to display the rational number r4 return 0; } Output://Must look like the following 2 (in any form , such as 54/27) 7/3 10/3 user enters data: Important instruction: Make sure that after printing r3,for the second time, print r1.

QUALITY: 100% ORIGINAL PAPERNO PLAGIARISM - CUSTOM PAPER

Recent Completed and delivered Papers

# Topic title Subject Area Academic Level Pages delivered
6
Writer's choice
Business
University
2
1 hour 32 min
7
Wise Approach to
Philosophy
College
2
2 hours 19 min
8
1980's and 1990
History
College
3
2 hours 20 min
9
pick the best topic
Finance
School
2
2 hours 27 min
10
finance for leisure
Finance
University
12
2 hours 36 min