Rational Numbers Assignment Adding

We have everything done except we do not know how to do the adding of rational numbers. can you help?

Code:

`#include "Rational.h"`

#include "math.h"

#include <iostream>

using namespace std;

Rational::Rational()

{

numerator = denominator = 1;

}

Rational::Rational(int N, int D)

{

numerator = N;

denominator = D;

}

int Rational::getN()

{

return numerator;

}

int Rational::getD()

{

return denominator;

}

int Rational::multiply(Rational rational2)

{

int finalN =getN()*rational2.getN();

int finalD =getD()*rational2.getD();

Rational rational(finalN,finalD);

simplify(rational);

}

int Rational::divide(Rational rational2)

{

int finalN =getN()*rational2.getD();

int finalD =getD()*rational2.getN();

Rational rational(finalN,finalD);

simplify(rational);

}

int Rational::add(Rational rational2)

{

int tempN = getN()*rational2.getD();

int tempD = getD()*rational2.getN();

int finalN = tempN*tempD

int finalD =

Rational rational(finalN,finalD);

simplify(rational);

}

void Rational::simplify(Rational rational)

{

int x=rational.getN();

int y=rational.getD();

int z;

while (y!=0)

{

z=x%y;

x=y;

y=z;

}

int finalN=rational.getN()/x;

int finalD=rational.getD()/x;

Rational rationalnew (finalN,finalD);

cout <<finalN<<"/"<<finalD<<endl;

}

bool Rational::compare(Rational rational2)

{

float initial=(float)getN()/getD();

float final= (float)rational2.getN()/rational2.getD();

if (initial==final) return true;

else return false;

}