Create a Rati mo
c++ question
pleas copy n paste ur working code here
![1. Create a Rational Number class.
a) data members: numerator and denominator
b) implement member accessors and mutators
c) implement a non-member output function which displays the number
as a fraction such as 5/7
d) instantiate and print the Rational Number 5/7
e) make sure that the solution is properly encapsulated](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fc30f57df-d966-4b83-97ec-f2c40d61e899%2F0b60a11b-9ab4-4bfb-89e0-1ee36673c9cc%2Fnl2lvqj_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
ANS- Source code-
#include<iostream>
// #include<conio.h>
using namespace std;
class findRational
{
private:
int num,den;
public:
void set(int n,int d)
{
num=n;
den=d;
}
void put()
{
cout<<"Rational Number as:";
cout<<num<<"/"<<den;
}
void find(findRational num1, findRational num2)
{
num=num1.num*num2.den+num2.num*num1.den;
den=num1.den*num2.den;
}
};
int main()
{
findRational ob1 ,ob2,ob3;
ob1.set(5,7);
ob2.set(1,7);
ob3.find(ob1,ob2);
ob3.put();
return 0;
}
Step by step
Solved in 3 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)