Rational Class in C++, programming homework help

Define a class called Rational. The class will represent objects that are rational numbers or what wethink of as fractions. Your class should have two integer member variables, one that represents thenumerator of a rational number and one that represents the denominator. Write three constructors foryour class: a default constructor that constructs the fraction 0/1, a single argument constructor thatconstructs a given integer value into a rational number by placing it as the numerator/1 and finally a twoargument constructor that allows the user to select both a numerator and denominator for your rationalnumber. The last constructor can be a bit tricky because it allows the user to give you values that are not insimplest form for example they could ask you to construct the fraction 4/2 which should be storedinternally as 2/1. How can this be done? Take a look at the Euclidean algorithm for computing thegreatest common divisor of two numbers (search the web). Implement this function as a helperfunction (private function) that your class can use when simplifying fractions.Lastly, for this assignment, overload the << operator so that you can output objects of type Rational tothe given stream so that they appear as numerator / denominator. Create a project called daily5 and a source file called daily5.cpp. Define a class called Rational. The class will represent objects that are rational numbers or what we think of as fractions. Your class should have two integer member variables, one that represents the numerator of a rational number and one that represents the denominator. Write three constructors for your class: a default constructor that constructs the fraction 0/1, a single argument constructor that constructs a given integer value into a rational number by placing it as the numerator/1 and finally a two argument constructor that allows the user to select both a numerator and denominator for your rational number. The last constructor can be a bit tricky because it allows the user to give you values that are not in simplest form for example they could ask you to construct the fraction 4/2 which should be stored internally as 2/1. How can this be done? Take a look at the Euclidean algorithm for computing the greatest common divisor of two numbers (search the web). Implement this function as a helper function (private function) that your class can use when simplifying fractions. Lastly, for this assignment, overload the

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER