You are writing a program to implement an abstract data


You are writing a program to implement an abstract data type Rational-Numbers. A rational number has two parts, numerator and denominator. Example 1/2 and 3/5 are rational numbers. You can perform math operations on rational numbers and the results are rational numbers. The following are the operations you are to implement.

Test your code with the following data:

Rational numbers: a = 3/8, b= 4/7, c = 1/5, d = 4/12, e = 3/5 f = 4/1 and g = 3/0 (your program should not error)

Compute and output the two rational numbers and their results: a + b, c * d, d / e, c - a

Below is where I am stuck:

Compute a+b*f - d print results

Compute d / a + c print results

Print out 'g' above.

Compare d == b Print both operands and the results.

Compare e != a Print both operands and the results.

Attachment:- rationalheader.zip

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: You are writing a program to implement an abstract data
Reference No:- TGS01245917

Now Priced at $20 (50% Discount)

Recommended (95%)

Rated (4.7/5)