Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL 10 High Performance Expert Techniques For Query Optimization High Availability And Efficient Database Maintenance

Authors: Ibrar Ahmed ,Gregory Smith ,Enrico Pirozzi

3rd Edition

1788474481, 978-1788474481

More Books

Students also viewed these Databases questions

Question

Describe the pacesetting leadership style AppendixLO1

Answered: 1 week ago

Question

4 How do Interpretive tasks help learners for Mediation?

Answered: 1 week ago