Exer 17
Exer 17
Exer 17
Description
2) After you have completed the Circle Class, implement a class called Cylinder that
extends the Circle class.
A cylinder has one additional data member for representing the height (type
double).
Create appropriate constructors for your Cylinder class
Include the necessary getters and setter for your additional attributes
Include methods for finding the volume and area of your Cylinder.
area = 2 * (area of the circle in this cylinder) +
2 * pi * radius + height
volume = (area of the circle in this cylinder) * height
Override the toString method of the Object class. Try to use the toString of
the Circle class and then just concatenate the remaining values
Override the equals method of the Object class. Two Cylinder objects are
equal if they have the same center and the same radius and the same height.
Write a simple main method that creates Cylinder objects and tests each of
the methods that you have defined.