Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ exercise pruning - Classes and Operator Overloading Please only C++, NOT C,

ID: 3565065 • Letter: C

Question

C++ exercise pruning - Classes and Operator Overloading

Please only C++, NOT C, or C#, or Java, please comment sections as to what

the 3 files needed are here -> http://codepad.org/PxOChPIQ

the 3 files are separated by commented titles of what their file names are

modifications that must be completed to attain points:

these are the modifications that need to be completed, original question was here -> http://tinyurl.com/mndy9k2

full points, to the person who comments next to the location of the modifications and explains what they did and how it affects the code. Thank you

C++ exercise pruning - Classes and Operator Overloading Please only C++, NOT C, or C#, or Java, please comment sections as to what the 3 files needed are here rightarrow the 3 files are separated by commented titles of what their file names are modifications that must be completed to attain points: Missing functions in Rational. More const and & opportunities No need for parameters to reduce. Why? Missing an value check in Rational. these are the modifications that need to be completed, original question was here rightarrow full points, to the person who comments next to the location of the modifications and explains what they did and how it affects the code. Thank you

Explanation / Answer

//rational.h #ifndef Rational_H #define Rational_H #include using namespace std; class Rational { private: int *numerator; int denominator; void reduce(int& ,int& ); public: Rational(); Rational(int a,int b=1); Rational operator+(const Rational); Rational operator*(const Rational); Rational operator-(const Rational); Rational operator/(const Rational); Rational& operator++(); Rational operator++(int not_needed); Rational& operator=(const Rational&); Rational& operator+=(const Rational&); Rational& operator-=(const Rational&); Rational& operator*=(const Rational&); Rational& operator/=(const Rational&); bool operator==(const Rational&); bool operator!=(const Rational&); friend ostream& operatornumerator) = numerator; reduce( *(this->numerator) , denominator ); } inline void Rational::setDenominator(const int& denominator) { this->denominator = denominator; reduce(*(this->numerator) , this->denominator ); } inline void Rational::decimals() const { cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote