class Point {
private int x;
private int y;
public Point() {
}
public Point(int x, int y) {
setPoint(x, y);
}
public int getX() {
return x;
}
public void setX(int x) {
this.x = x;
}
public int getY() {
return y;
}
public void setY(int y) {
this.y = y;
}
public void setPoint(int x, int y) {
setX(x);
setY(y);
}
public String toString() {
return "(" + x + "," + y + ")";
}
}
class Circle extends Point {
protected int r;
public Circle() {
}
public Circle(int x, int y, int r) {
setCircle(x, y, r);
}
public int getR() {
return r;
}
public void setR(int r) {
this.r = r;
}
public void setCircle(int x, int y, int r) {
setPoint(x, y);
setR(r);
}
public String toString() {
return String.valueOf(Math.PI * r * r);
}
}
class Cylinder extends Circle {
private int h;
public Cylinder() {
}
public Cylinder(int x, int y, int r, int h) {
setCylinder(x, y, r, h);
}
public int getH() {
return h;
}
public void setH(int h) {
if (h > 0)
this.h = h;
}
public void setCylinder(int x, int y, int r, int h) {
setCircle(x, y, r);
setH(h);
}
public String toString() {
return String.valueOf(Math.PI*r*r*h);
//return String.valueOf(Double.parseDouble(super.toString()) * h);
}
}
public class Exec {
public static void main(String[] args) {
Cylinder c=new Cylinder(1,2,3,4);
System.out.println(c);
}
}