```
class Fraction
{
public:
Fraction();
Fraction(int numerator, int denominator);
void divide(int& num, int& denom) const;
void multiply(int& num, int& denom) const;
void add(int& num, int& denom) const;
void substract(int& num, int& denom) const;
int getNum() const;
int getDenom() const;
bool operator > (const Fraction& otherFraction) const;
bool operator < (const Fraction& otherFraction) const;
bool operator == (const Fraction& otherFraction) const;
private:
int num;
int denom;
int x1;
int y1;
int x2;
int y2;
};
```

```
#include "fraction.h"
#include <iostream>
Fraction::Fraction(int,int)
{}
bool Fraction::operator > (const Fraction& otherFraction) const
{
if (num > otherFraction.num)
return true;
else if (num < otherFraction.num)
return false;
else if (denom > otherFraction.denom)
return true;
else if (denom < otherFraction.denom)
return false;
else
return true;
}
bool Fraction::operator < (const Fraction& otherFraction) const
{
if (num < otherFraction.num)
return true;
else if (num > otherFraction.num)
return false;
else if (denom < otherFraction.denom)
return true;
else if (denom > otherFraction.denom)
return false;
else
return true;
}
bool Fraction::operator == (const Fraction& otherFraction) const
{
return (num==otherFraction.num) && (denom==otherFraction.denom);
}
void Fraction::divide(int& num, int& denom) const
{
num = (x1 * y2);
denom = (y1 * x2);
}
void Fraction::multiply(int& num, int& denom) const
{
num = (x1 * x2);
denom = (y1 * y2);
}
void Fraction::add(int& num, int& denom) const
{
num = ((x1 * y2) + (y1 * x2));
denom = (y1 * y2);
}
void Fraction::substract(int &num, int &denom) const
{
num = ((x1 * y2) - (y1 * x2));
denom = (y1 * y2);
}
int Fraction::getNum() const
{
return num;
}
int Fraction::getDenom() const
{
return denom;
}
```

```
#include <iostream>
#include "fraction.h"
using namespace std;
int main()
{
Fraction fraction1(3,4);
Fraction fraction2(5,6);
if (fraction1 > fraction2)
cout << "Fraction 1 is greater than Fraction 2" << endl;
if (fraction2 < fraction1)
cout << "Fraction 2 is less than Fraction 1" << endl;
if (fraction1 == fraction2)
cout << "Fraction 1 is equal to Fraction 2" << endl;
return 0;
}
```

This is the direction: Create a new advanced data type called Fraction that saves numerator and denominator. There are functions to Add, Subtract, Divide, Multiply the fractions. There are two other functions to return the numerator and denominator. Finally, an overloaded operator should be able to compare whether two fraction objects are greater than, less than, or equal to one another.

1. Am I on the right track?

2. How do i get the fractions to add, subtract, divide, and multiply?