Question: Write as C++ program, rational_main.cpp, Rational.cpp, and Rational.h Description: Implement a complete class named Rational for dealing with rational numbers. In mathematics, a rational number

Write as C++ program, rational_main.cpp, Rational.cpp, and Rational.h Write as C++ program, rational_main.cpp, Rational.cpp, and Rational.h Description: Implement a complete

Description: Implement a complete class named Rational for dealing with rational numbers. In mathematics, a rational number is any number that can be expressed as the quotient or fraction p/q of two integers, a numerator p and a non-zero denominator q 1) Constructor that support the following usage. Print an error message and exit if q is 0 9 Rational (22, 7); /22/7 a) r3=r1 + r2; c) r3 = n + r1; 2) Support the following operations: Rational l, r2, r3; double x; int n; d) rl.print(n); output rl with n fractional digits. n 0, ex: 3.123324423424242342424324332424234 3) Provide a main function and illustrate the use of the class. MUST provide the definition and implementation files. Do not use any inline implementations

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!