Question: Create a class called Rational to implement rational numbers with the following public member functions. Constructors: Rational(). and Rational(double top, double bottom) Member functions: void
Create a class called Rational to implement rational numbers with the following public member functions. Constructors: Rational(). and Rational(double top, double bottom) Member functions: void print () - Prints top/bottom using cout. Rational add(const Rational &secondRational) Overloaded addition operator: Rational operator* (const Rational &secondRational) Implement the dass inline including all constructors, create all necessary private variables member functions, overloaded operators as outlined above Note: no need to separate implementation from interface. A rational number is a number with a numerator a and a denominator b in the form a/b. You can assume positive rational numbers only. The following equations can be used to perform the indicated operation on rational numbers addition: a/b + c/d = (a*d + c*b)/(b*d) You do NOT need to reduce the resulting rational numbers. For example, you do not need to reduce 4/6 to 2/3. To test your implementation you will need to create a main, construct two rational numbers 3/7 and 25/9, display each of them, add both numbers and display the result
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
