Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am reposting this for someone who knows how to do the full 'Overloading' that is being asked. If you do not know how to

I am reposting this for someone who knows how to do the full 'Overloading' that is being asked. If you do not know how to do it, please let someone answer who does.

This is PART 1. I have already written a program which works, I am adding this for reference.

========================================

image text in transcribed

This is PART 2. This is the part I need help with. You can add a main() driver if it is helpful but just writing all the working overloading function definitions is sufficient

====================

image text in transcribed

Thanks in advance!!

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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions