Find the comments against each line for the description

Assignment Help C/C++ Programming
Reference no: EM132095290

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.

Reference no: EM132095290

Questions Cloud

Explain how nasa engineers were not properly trained : A fight against pollution and resource depletion is best described as the central concern of which of the following?
Find the mean and standard deviation of a number of data : Write a program, using C#, that will find the mean and standard deviation of a number of data points.
Develop the code in a step-by-step manner : You may add other methods if needed, however, all the methods and the variables indicated in the UML diagram must be implemented.
Discuss about the penetration testing : In information security, penetration testing may be wrongly perceived as being a "hacker-like" activity.
Find the comments against each line for the description : Modify the program above program so that it contains a class related to the Leibniz formula. Add additional methods to the class .
What is the recurrence for the worst-case runtime : What is the recurrence for the worst-case runtime of the algorithm below?
Design the circuit using one rotate-right circuit : Design the circuit using one rotate-right circuit, one rotate-left circuit, and one 2-to-1 multiplexer to select the desired result. Derive the code.
Discuss ipv4 and ipv6 according to its capabilities : Discuss IPv4 and IPv6 according to its capabilities to address a single device on any network in the world and how it correlates to the Internet of Things.
Explain with risk management is it appropriate to know : What if you move forward with a risk you think is manageable but not mitigate it?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd