py thon
Posted: Sun May 15, 2022 11:48 am
py
thon
3. Import Class a) Import pi only from math module. b) Implement a class Circle with an attribute, radius. c) Implement an init method with an optional parameter type. Set the default value of the attributes of radius to 1. d) Implement a display method to print the value of radius. e) Implement a setRadius method to assign radius to the instance variable. f) Implement a getRadius method to return the value of the instance variable radius. g) Implement an area method to return the value of area of a circle. h) Implement a circumference method to return the value of circumference of a circle. i) Save Rectangle class and Circle class as shapes.py. 3) Import Rectangle class and Circle class from shapes.py. k) Employs the Rectangle class methods and Circle class methods above and set and get various measurements of a rectangle and a circle. Example Output Width: 1 Height: Get Width: 125 Get Height: 1.25 Area: 1.56250 Radiis: 0 Get Radius: 10 AYCA: 314. 15927 Circumference: 62.33/185
thon
3. Import Class a) Import pi only from math module. b) Implement a class Circle with an attribute, radius. c) Implement an init method with an optional parameter type. Set the default value of the attributes of radius to 1. d) Implement a display method to print the value of radius. e) Implement a setRadius method to assign radius to the instance variable. f) Implement a getRadius method to return the value of the instance variable radius. g) Implement an area method to return the value of area of a circle. h) Implement a circumference method to return the value of circumference of a circle. i) Save Rectangle class and Circle class as shapes.py. 3) Import Rectangle class and Circle class from shapes.py. k) Employs the Rectangle class methods and Circle class methods above and set and get various measurements of a rectangle and a circle. Example Output Width: 1 Height: Get Width: 125 Get Height: 1.25 Area: 1.56250 Radiis: 0 Get Radius: 10 AYCA: 314. 15927 Circumference: 62.33/185