Printing rational numbers in floating-point


(Rational Class) Create a class called Rational for performing arithmetic with fractions. Write a program to test your class.
1/2+2/3+3/4.......+98/99+99/100
Use integer variables to represent the private data of the classthe numerator and the denominator. Provide a constructor that enables an object of this class to be initialized when it is declared. The constructor should contain default values in case no initializers are provided and should store the fraction in reduced form. For example, the fraction would be stored in the object as 1 in the numerator and 2 in the denominator. Provide public member functions that perform each of the following tasks:

Adding two Rational numbers. The result should be stored in reduced form.

Subtracting two Rational numbers. The result should be stored in reduced form.

Multiplying two Rational numbers. The result should be stored in reduced form.

Dividing two Rational numbers. The result should be stored in reduced form.

Printing Rational numbers in the form a/b, where a is the numerator and b is the denominator.

Printing Rational numbers in floating-point format. 

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Printing rational numbers in floating-point
Reference No:- TGS0131770

Expected delivery within 24 Hours