Question: C++ ONLY I NEED THE CODE PLEASE Create a program to handle Rational numbers using functions. A Rational number has 2 parts, an int numerator
C++ ONLY I NEED THE CODE PLEASE
Create a program to handle Rational numbers using functions. A Rational number has 2 parts, an int numerator and an int denominator. Output data should print as: numerator/denominator. Input data can be read in from a file as two integer values separated by a space. Code 5 functions to combine two Rational numbers in addition, subtraction, multiplication, division and negation. Code 6 functions to test if two Rational numbers are equal, not equal, less than, less than or equal, greater than, and greater than or equal. Code a main method to read in the two sets of data and test test all methods follow the output format given below. Reducing values to lowest terms is extra credit. Run 3 times with the following data: 2/3 and and 16/32 3/-5 and 2/1. Sample Format for Output on the Screen: Rational Number 1 _________ reduced ________ Rational Number 2 _________ reduced ________ R1 + R2 = ________ reduced ________ R1 - R2 = ________ reduced _____ R1 * R2 = ________ reduced ________ R1 / R2 = ________ reduced ________ (-) R1 = _________ reduced ________ R1 == R2 _________ (true or false) R1 != R2 _________ (true or false) R1 < R2 _________ (true or false) R1 <= R2 _________ (true or false) R1 > R2 _________ (true or false) R1 >= R2 _________ (true or false) Logic for Rational Operations: a/b + c/d = (a*d + b*c) / (b*d) a/b c/d = (a*d b*c) / (b*d) (a/b) * (c/d) = (a*c) / (b*d) (a/b) / (c/d) = (a*d) / (c*b) (a/b) = (-a/b) (a/b) = = (c/d) means (a*d) = = (c*b) (a/b) != (c/d) means (a*d) != (c*b) (a/b) < (c/d) means (a*d) < (c*b) (a/b) < = (c/d) means (a*d) < = (c*b) (a/b) > (c/d) means (a*d) > (c*b) (a/b) >= (c/d) means (a*d) >= (c*b) Turn in the project assignment, the algorithm, the source code, the output and the Academic Honesty Promise, in that order, in a folder with clamps. Put the proper identification on the front of the folder.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
