Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In the following, two classes Circle and Cylinder are to be implemented. A UML diagram of the classes to be implemented is shown in the

image text in transcribed

In the following, two classes Circle and Cylinder are to be implemented. A UML diagram of the classes to be implemented is shown in the figure below. Question 1: Parent class Circle In the following code cell, first implement the parent class. To do this, proceed as follows: 1.) First implement the getter and setter methods for a variable radius. These methods shall have the names and _set_radius(self, radius). The _set_radius(self, radius) method shall initialize a private attribute with the passing parameter radius. The _get_radius(self) method shall return the value of the private attribute 2.) Then implement an method. Within this method, the only private attribute of this class is to be initialized with the value of the passing parameter of the function by using the property object (public variable radius). 3.) Finally, implement the two methods base_area(self) and circumference(self). These are to calculate and return the area and the circumference of the circle, respectively. Use the constant PI defined at the beginning of the code cell for the calculation. The part where to write the program code is marked with a comment \#WRITE YOUR CODE HERE. Code cell: import math PI= math.pi class Circle(): \# WRITE YOUR CODE HERE radius = property ( _get_radius, __set_radius )

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

The World Wide Web And Databases International Workshop Webdb 98 Valencia Spain March 27 28 1998 Selected Papers Lncs 1590

Authors: Paolo Atzeni ,Alberto Mendelzon ,Giansalvatore Mecca

1st Edition

3540658904, 978-3540658900

More Books

Students also viewed these Databases questions