Question: IN C++ LANGUAGE PLEASE Write a class Rational for performing arithmetic with fractions. Use integers to represent the (private) variables numerator and denominator. Provide a

IN C++ LANGUAGE PLEASE Write a class Rational for performing arithmetic withIN C++ LANGUAGE PLEASE

Write a class Rational for performing arithmetic with fractions. Use integers to represent the (private) variables numerator and denominator. Provide a constructor function that enables an object of this class to be initialized, and which should contain default values in case no input is provided. The constructor should also guarantee that the fraction is stored in re duced form, so that for example) the inputs 2 and 4, for the fraction 4 will be stored with numerator 1 and denominator 2 Also provide public functions for the following operations Addition of two rational numbers, where the result should be stored in reduced form Subtraction of two rational numbers, where the result should be stored in reduced form Multiplication of two rational numbers, where the result should be stored in reduced form Division of two rational numbers, where the result should be stored in reduced form. Printing rational numbers Cusing cout in the form of a b where a is the numerator and b is the denominator Printing rational numbers in floating point format

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!