Use integer variables to represent the private data of the class
- Numerator
- Denominator
Provide a constructor that enable an object of this class to be initialized when it's declared. The constructor should contain default values in case no initializer are provided and should store the fraction in reduced form. For example, the fraction 2/4 would be stored in the object as 2 in the numerator and 4 in the denominator. Provide public member functions that perform each of the following tasks:
i. Adding two Rational numbers. The results should be stored in reduced form.<br>
ii. Subtracting two Rational numbers. The results should be stored in reduced form.<br>
iii. Multiplying two Rational numbers. The results should be stored in reduced form.<br>
iv. Dividing two Rational numbers. The results should be stored in reduced form.<br>
v. Printing Rational numbers in the form a/b, where a is the numerator and b is the denominator.<br>
vi. Printing Rational in floating-point format.