Modify the program above program so that it contains a


Please find the required program and output below: Please find the comments against each line for the description:

import math # This will import math module

def calculate_pi(): # function that return value of m(i) for input i
sum = 0
for j in range(0,12): #iterate loop till 12 times
sum = sum + (math.pow(-1,j)/((2*j)+1)) #summation of the Leibniz series
pi = 4 * sum
return float(pi) #return number

#print the output
print ("pi = ", calculate_pi())

Question1. Add these to above program:

description of the program in a header block

programmer name in a header block

documentation string included in the function

Question 2. Modify the program above program so that it contains a class related to the Leibniz formula. Add additional methods to the class for doing calculations based on the pi attribute.

Divide your program into two modules - one which contains your class and another which demonstrates the class methods. Enable a user to enter the number of values to be used in the pi calculation.

Be sure your program contains exception handling and has been debugged. It should also launch and be usable under Windows 10 as described in class.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Modify the program above program so that it contains a
Reference No:- TGS02888747

Expected delivery within 24 Hours