A. Write a program to create the class Point. Perform the following operations on it. a. Initialise.
a. Initialise X and Y coordinates of the point.
b. Print the coordinates by defining the method ‘Display()’.
c. Define the method Translate(X, Y) to move the point X units in X direction and Y units
in Y direction.
B. Write a program to implement single inheritance.
a. Create the parent class Circle. Initialise the constructor with the radius of the circle.
b. Define the method get_radius() and calc_area() to know the radius and area of the
circle. c. Create the child class named Cylinder. Initialise the value of the height within the
constructor and call the constructor of the parent class to initialise the radius of the cylinder.
d. Finally, defi ne the method Calc_area() in the class Cylinder to calculate the area of the
cylinder.
Note: Area of Cylinder = 2 * pi * radius * height
Leave a Reply