# Design a Cylinder class with members of radius, height

## How to design a Cylinder class with given members of radius and height?

Please input the radius: 3

Please input the height: 12

## Designing a Cylinder class with radius and height

In order to design a Cylinder class with members of radius and height, we need to create a class with appropriate attributes and methods.

When designing a Cylinder class in Python with members of radius and height, we can create a class called Cylinder with the following structure:

**python**

class Cylinder:

def __init__(self, radius, height):

self.radius = radius

self.height = height

def volume(self):

return 3.14 * self.radius ** 2 * self.height

def surface(self):

return (2 * 3.14 * self.radius * self.height) + (2 * 3.14 * self.radius ** 2)

The above implementation of the Cylinder class includes an __init__ method as the constructor to initialize the object with the given values of radius and height. The volume method calculates the volume of the cylinder using the formula V = π * r^2 * h, where π is approximately 3.14, r is the radius, and h is the height. The surface method calculates the surface area of the cylinder using the formula A = 2πrh + 2πr^2.