Question: C++. 1. A rational number has two parts: a numerator and a denominator, for example, 5/6 (five-sixths, also known as approximately .833). Look up the
C++.

1. A rational number has two parts: a numerator and a denominator, for example, 5/6 (five-sixths, also known as approximately .833). Look up the definition if you need to. In this question, we will implement a user-defined type whose objects store a rational number; the structure of which is detailed in the following UML diagram: class Rational numerator: int - denominator: int + Rational(numerator: int, denominator: int (a) Write the class definition for the Rational class to the specifications in the UML diagram above (b) Write assignment, addition, subtraction, multiplication, division, and equality operators. For each, determine whether it is best practice to implement the operator as a member or non-member helper function (c) Why would someone want to use a Rational class? (d) Give an example of a calculation where a Rational gives a mathematically better result than double
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
