py thon

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

py thon

Post by answerhappygod »

py
Py Thon 1
Py Thon 1 (362.58 KiB) Viewed 40 times
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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply