Modify constructor for the fraction class so that gcd is


Programming Assignment

Use the fraction.py and Complete the following:

1. Modify the Constructor for the Fraction class so that GCD is used to reduce fractions immediately. This means that the __add__ function no longer needs to reduce.

2. Implement the remaining simple arithmetic operators (__sub__, __mul__, and __truediv__).

3. Implement the remaining relational operators (__gt__, __ge__, __lt__, __le__, and __ne__).

4. Modify the constructor for the Fraction class so that it checks to make sure that the numerator and denominator are both integers. If either is not an integer the constructor should raise an exception.

Attachment:- Unconfirmed 185256.rar

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: Modify constructor for the fraction class so that gcd is
Reference No:- TGS02464509

Now Priced at $35 (50% Discount)

Recommended (97%)

Rated (4.9/5)