Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 implementationsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started