3. Import Classa) 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.j) 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 arectangle and a circle.
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.
j) 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.
Question 3 is the main goal, question 2 is reference. In Python Please and Thank you.
Question 3 is the main goal, question 2 is reference.
In Python Please and Thank you.
2 Import Class a) limplement a class Rectangle wide wettbutes, wide and high by implement ant method with a parameter types Set the default value of the attributes of width and height to c) Implement a display method to print the values of width and height di Implementarih method to assign width to the instance variable. c) Implement a light method tog height to the instance variable Implancet ad method to return the value of the instance variable width & Implementa gitig method to return the value of the instance variable height h) Implement an area method to return the value of area of a rectangle 1) Suvo Rectangle clasa a rectangle.py j) Import Rectangle class from rectangle Employs the Rectangle class methods above to stand get various mensucments of a rectangle 1) Instantiate two objects of type rectangle one with anyuments one without - tangle 12 Rectangle 21 Call display to prawidth and height 3) Collar in prit) to display the area of land 2 4) Call setWidth) and theight) to update width and height to 6 of 12 5) Call get Width() in peintl) to display the updated width of Call get fight in primi) to display the updated height of 2 7) Call meat in print) to display the wea of 12. Example Output width: 4 Height: 5 Area: 20 ET 378 Programming and patients with som PENT - Classes Page 2 of 2 Width: Height : 1 Area: 1 Get Width 5 Get Weight: 6 Area: 36 3. Import Class a) Import planly from mat module b) Implement a class me with an attributerades c) Implement an inif method with an optional parameter type Set the default value of the attributes of radiato di Implementadplay method to print the value of adres e luplement dis mothed to sign radius to the instance Variable Implementa gadis method to retum the value of the instance variables & Implement and method to return the value of area of a circle Implementacion method to retum the value of circumference of a circle Save Rectangle class and Circle class as shapeupy 1) Import Rectangle class and Circle class from shapes Employs the Rectangle class methods and Circle class methods above and set and get various measurements of a rectangle and acce Example Outpat Width 1 Height : Get Width: 1.25 Got Height: 1.25 hrea: 1.56250 Radius: Get Radio 10 Area: 314.1592 Circunference: 62.83185
3. Import Classa) Import pi only from math module.b) Implement a class Circle with an attribute, radius.c) Implement an
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
3. Import Classa) Import pi only from math module.b) Implement a class Circle with an attribute, radius.c) Implement an
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!