about summary refs log tree commit diff
path: root/usth/ICT2.2/labwork/5/Java/abstract/Cylinder.java
blob: 8fa9e0c3ad9f3246e840487e58a261e1ec29aafd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
public class Cylinder extends Circle
{
  public double h;

  public Cylinder(double x, double y, double r, double h)
  {
    super(x, y, r);
    this.h = h;
  }

  public double calArea() { return super.calArea()*2.0 + r*h*Math.PI*2.0; }
  public double calVolume() { return super.calArea() * h; }
  public String getName() { return "Circle"; }
}