Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For this programming assignment you will be implemented a RationalNumber class. In mathematics, a rational number is a number that can be represented as a

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
For this programming assignment you will be implemented a RationalNumber class. In mathematics, a rational number is a number that can be represented as a fraction, where both the numerator and the denominator in the fraction are integers (Le., whole numbers). Every integer is a rational number, because the denominator in the fraction can be 1 (i.e, 7 can be represented as 7/1) Some (but not all floating pointer numbers (e, real numbers) are rational numbers as well. The floating point number 2.5 is also a rational number, because it can be represented as the fraction 5/2. Create a class RationalNumberffractions) with these capabilities: a. Implement a constructor that receives two integer parameters (the first is the numerator, and the second is the denominator) that prevents a 0 denominator in a fraction, reduces or simplifies fractions that are not in reduced form and avoids negative denominators b. Implement a printRational member function that prints out a RationalNumber object. c. Overload the addition (+), subtraction (-), multiplication(),division (U/) operators, and assignment () operators for this class d. Overload the relational and equality (, ,,, and l-) operators for this class Sample run 1 (using the app prog1 application program): Rationa1Number c( 7, 3, d 3, 9), x; /3 1/3 2 7/3 1/3 7/9 7/3 is: > 1/3 according to the overloaded operator >-1/3 according to the overloaded 1/3 according to the overloadedoperator 1/3 according to the overloadedoperator 1/3 according to the overloadedoperator

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

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago