Create a Circle class with 2 attributes (radius(decimal), pi(decimal)). Create a constructor with 1 parameter for radius
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Create a Circle class with 2 attributes (radius(decimal), pi(decimal)). Create a constructor with 1 parameter for radius
Create a Circle class with 2 attributes (radius(decimal), pi(decimal)). Create a constructor with 1 parameter for radius. Pi has a default value β 3.14. Create accessor methods for these attributes. Create an area() method that returns the area of the circle. ( π΄ = ππ2) Create a Cylinder class that extends Circle class and add 1 more attribute (height). Create accessor method for this attribute and a constructor with 2 parameters that calls the constructor from the superclass. Create a volume() method that returns the volume of the cylinder by using the method area() from the superclass. (π = hππ2) Override the area() method to calculate the area of the entire surface of the cylinder. (π = 2ππ2 + 2hππ ).