Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Cylinder extends Circle {
- private double height;
- public Cylinder() {
- super.Circle();
- }
- public Cylinder(double height) {
- super.Circle(height);
- }
- public Cylinder(double radius, double height) {
- super.Circle(radius, height);
- }
- public double getHeight() {
- return height;
- }
- public double getVolume() {
- return getArea()*height;
- }
- @Override
- public String toString() {
- return "Cylinder: subclass of " + Circle.toString();
- + " height=" + height;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement