# *python creating objects with overloaded operators

### Part 1: Complete Fraction Class

Complete the implementation of the Fraction class provided below.

``class Fraction:#Constructor. Puts fraction in simplest formdef __init__(self,a,b):self.num = aself.den = bself.simplify()#Print Fraction as a Stringdef __str__(self):if self.den==1:return str(self.num)else:return str(self.num)+"https://www.homeworkmarket.com/"+str(self.den)#Get the Numeratordef getNum(self):return self.num#Get the Denominatordef getDen(self):return self.den#Give Numerical Approximation of Fractiondef approximate(self):return self.num/self.den#Simplify fractiondef simplify(self):x = self.gcd(self.num,self.den)self.num = self.num // xself.den = self.den // x#Find the GCD of a and bdef gcd(self,a,b):if b==0:return aelse:return self.gcd(b,a % b)#Complete these methods in labdef __add__(self,other):return 0def __sub__(self,other):return 0def __mul__(self,other):return 0def __truediv__(self,other):return 0def __pow__(self,exp):return 0``

Complete Implementation of the following methods. All of these methods will return an instance of the Fraction class.

### Part 2: Fraction Problems

Create a file lab3.py. In this file, use your fraction class to implement functions for each of the following formula. You program should ask the user for the value of n to use in the summations.

Remember that a summation symbol just tells you to add all the values in a range.

Write functions for each of the below expressions.

1. Harmonic Series:
2. Two:
3. Zero:
4. Partial Riemann Zeta:

Your program will ask for n as input. Compute each of the functions for the given input n. When computing the Riemann Zeta function, print values for b=2,3,4,5,6,7,8.

Verify that the input is a valid number. If it is not, ask repeatedly until a valid number is given.

Once you have been given a valid input, print out the values of each of the functions in the order H, T, Z, R. See below execution trace for exact layout.

### Scoring

• Part 1
• 6pts – Subtract
• 6pts – Multiply
• 6pts – True Divide
• 6pts – Power
• Part 2
• 10pts – H Function
• 10pts – T Function
• 10pts – Z Function
• 10pts – R Function

### Example Execution Trace

``Welcome to Fun with Fractions!Enter Number of iterations (integer>0):Bad InputEnter Number of iterations (integer>0):10H(10)=7381/2520H(10)~=2.92896825T(10)=2047/1024T(10)~=1.99902344Z(10)=1/1024Z(10)~=0.00097656R(10,2)=1968329/1270080R(10,2)~=1.54976773R(10,3)=19164113947/16003008000R(10,3)~=1.19753199R(10,4)=43635917056897/40327580160000R(10,4)~=1.08203658R(10,5)=105376229094957931/101625502003200000R(10,5)~=1.03690734R(10,6)=52107472322919827957/51219253009612800000R(10,6)~=1.01734151R(10,7)=650750820166709327386387/645362587921121280000000R(10,7)~=1.00834915R(10,8)=1632944765723715465050248417/1626313721561225625600000000R(10,8)~=1.00407735``

## Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
\$26
The price is based on these factors:
Number of pages
Urgency
Basic features
• Free title page and bibliography
• Unlimited revisions
• Plagiarism-free guarantee
• Money-back guarantee
On-demand options
• Writer’s samples
• Part-by-part delivery
• Overnight delivery
• Copies of used sources
Paper format
• 275 words per page
• 12 pt Arial/Times New Roman
• Double line spacing
• Any citation style (APA, MLA, Chicago/Turabian, Harvard)

# Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

### Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

### Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

### Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.