A rational number is of the form ab where a and b are


Question: A rational number is of the form a/b where a and b are integers with b not equal to zero. Develop a class for processing rational numbers. The class should have a numerator data member and a denominator data member. It should read and display all rational numbers in the format a/b; for output, just display a if the denominator is 1. The following examples illustrate the operations that should be provided:

A rational number x can be entered in the form

a or a/b. (e.g. 4, 3/4, 5/2)

x + y addition

x - y subtraction

x * y multiplication

x / y division

Solution Preview :

Prepared by a verified Expert
Basic Statistics: A rational number is of the form ab where a and b are
Reference No:- TGS02444763

Now Priced at $15 (50% Discount)

Recommended (91%)

Rated (4.3/5)