Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise: Get Circumference Method Description In this exercise, you will add to your circle class a method to calculate the circumference of a circle instance.

image text in transcribed

image text in transcribed

Exercise: Get Circumference Method Description In this exercise, you will add to your circle class a method to calculate the circumference of a circle instance. If you don't know the formula, find it. Use an approximation for pi that has at least 7 digits. Class Name Circle Method getcircumference () Parameters self: the circle object to use Action Calculates the circumference of the circle and returns it. Return Value A number, the circumference of the circle. Examples c = Circle (0.5) c.getcircumference () -> 3.1415926535... Hints Remember, you're adding to the code from the previous step. math.pi from the math module has a reasonable approximation of Pi. import math class Circle: def __init__(self, r): self.radius = r. def getRadius(self): return self.radius def getArea(self): area = self.radius*self.radius*math.pi return area = def setRadius(self, radius): if radius >= 0: self.radius = radius return True else: return false

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions

Question

Define Administration and Management

Answered: 1 week ago

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago