Select Page

Your Perfect Assignment is Just a Click Away

Starting at \$8.00 per Page

100% Original, Plagiarism Free, Customized to Your instructions!

Description

A rational number is a number that can be represented as the quotient of two integers. For example, 1/2, 3/4, 64/2, and so forth are all rational numbers. (By 1/2, etc., we mean the everyday meaning of the fraction, not the integer division this expression would produce in a C++ program.) Represent rational numbers as two values of type int, one for the numerator and one for the denominator. Call the class Rational.

Include:

1. a constructor with two arguments that can be used to set the
member variables of an object to any legitimate values.
2. a constructor that has only a single parameter of type int; call this single
parameter whole_number and define the constructor so that the object
will be initialized to the rational number whole_number/1.
3. a default constructor that initializes an object to 0 (that is, to 0/1).

1. the input and output operators >> and <<. Numbers are to be
input and output in the form 1/2, 15/32, 300/401, and so forth. Note
that the numerator, the denominator, or both may contain a minus
sign, so -1/2, 15/32, and -300/-401 are also possible inputs.
2. all of the following operators so that they correctly apply to the type
Rational: ==, <, <=, >, >=, +, -, *, and /.

(Hints: Two rational numbers a/b and c/d are equal if a*d equals
c*b. If b and d are positive rational numbers, a/b is less than c/d
provided a*d is less than c*b. You should include a function to normalize
the values stored so that, after normalization, the denominator
is positive and the numerator and denominator are as small
as possible. For example, after normalization 4/-8 would be represented
the same as -1/2.)

Requirements

2. Follow the ADT (Abstract Data Type) guideline to implement the required class.
3. Comment well in your program and any functions you use

Test Cases

1/2, -1/2, 4, 0, -/12 (should cause error)

Demo

`Welcome to the Rational World of Wonders!Please enter a rational number for this calculation:1/21/2 + 1/2 = 11/2 - 1/2 = 01/2 * 1/2 = 1/41/2 / 1/2 = 11/2 == 1/2 : true1/2 < 1/2 : false1/2 <= 1/2 : true1/2 > 1/2 : false1/2 >= 1/2 : true`

"Place your order now for a similar assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Our Service Charter

1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.