Code:#include <iostream> #include <cmath> using namespace std; class rational { public: rational(); rational add(rational); rational sub(rational); rational mul(rational); rational div(rational); rational inv(rational); int getdenominator(); int getnumerator(); void print(rational); private: int numerator; int denominator; }; void rational::print(rational)//make sure it is right { cout << numerator << "/" << denominator << endl; } rational rational::inv(rational b) { return rational.reciprocal(b.getdenominator(),b.getnumerator());//added . not sure if it is right } rational rational(int num ,int den )//i added rational the class name in t he front { int numerator=num; int denominator=den; } rational rational::add(rational b) { { int num1 = (this.numerator * b.denominator) + (b.numerator * this.denominator); // cross multily and add int num2 = this.denominator * b.denominator; // multiply the denominators to make them equivlent return rational answer(num1,num2); } rational rational::sub(rational b) { int num1 = (this.numerator * b.denominator) - (b.numerator * this.denominator);// cross multiply and subtact int num2 = this.denominator * b.denominator; return rational answer(num1,num2); } rational rational::mul(rational b) { int num1 = this.numerator * b.numerator; // multiplys straight accross int num2 = this.denominator * b.denominator; return rational answer (num1,num2); } rational rational::div(rational b) { rational reciprocal=inv(b); int num1=numerator*reciprocal.numerator; int num2=denominator*reciprocal.denominator; /* int num1 = this.numerator * b.denomerator; //multiplys the inverse of 2nd fraction object to divide int num2 = this.denomerator * b.numerator; */ return rational answer (num1, num2); } int main() { rational c(4,2); rational d(8,4); rational x; a.print(); cout << " addition "; b.print(); x = c.add(d); cout << " = "; x.print(); cout << '\n'; x.print(); cout << " = "; cout << "\n\n"; c.print(); cout << " subtraction "; d.print(); x = c.sub(d); cout << " = "; x.print(); cout << '\n'; x.print(); cout << " = "; cout << "\n\n"; c.print(); cout << " multiplication "; d.print(); x = c.mul(d); cout << " = "; x.print(); cout << '\n'; x.print(); cout << " = "; cout << "\n\n"; c.printRational(); cout << " division "; d.printRational(); x = c.div(d); cout << " = "; x.printRational(); cout << '\n'; x.printRational(); cout << " = "; cout << endl; system("pause"); return 0; }