Question: Task 8 Write a Cylinder class to get the desired output as shown below. 1. You will have to create a Cylinder class. 2. You

 Task 8 Write a Cylinder class to get the desired output

Task 8 Write a Cylinder class to get the desired output as shown below. 1. You will have to create a Cylinder class. 2. You will have to create 2 class variables. 3. Create a required constructor 4. Write 2 class methods: One that takes the height first and then the radius and then swaps . One that takes a string where the radius and height values are separated with a hyphen Write 2 static methods: One that calculates the area of a whole cylinder (formula: 22 +2h) Another that calculates the volume of a cylinder (formula: tareh) "Observe the output values carefully to understand how the radius and height values are changing | You are not allowed to change the code below! Write your code here Output: Default radius=5 and height=18. c1 = Cylinder(0,0) Updated: radius=0 and height=0. Cylinder areac1.radius,c1.height) Area: 0.0 Cylinder.volumec1.radius.c1.height) Volume: 0.0 print("ASS== Default radius=0 and height=0 c2 = Cylinder swap(8.3) Updated: radius=3 and height=8 c2 area(c2.radius.c2 height) Area: 207 34511513692635 c2.volume(c2.radius,c2.height) Volume: 226.1946710584651 print('===============================" c3 = Cylinder changeFormat(*7-13") Default radius 3 and height 8. c3.area(c3.radius.c3.height) Updated: radius=7.0 and height=13.0. c3.volume(c3.radius.c3.height) Area: 879.645943005142 Volume: 2001.1945203366981 print Cylinder(0.3,5.56).arealCylinder radius Cylinder height) Default radius=7.0 and height13.0. print Updated: radius=0.3 and height=5.56. Cylinder(3.5)volume(Cylinder radius Cylinder height)) Area: 11.045839770021713 Default radius=0.3 and height=5.56. Updated: radius=3 and height=5. Volume: 141.3716694115407 SESSE Page 8 T 17

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!