class Circle{
private double radius;
public Circle(double radius) {
this.radius = radius;
}
public double findArea(){
return Math.PI * this.radius * this.radius;
}
public double getRadius(){
return this.radius;
}
}
class Cylinder{
private double length;
private Circle cir;
public Cylinder(double length, Circle cir) {
this.length = length;
this.cir = cir;
}
public double findVolume(){
return this.cir.findArea() * this.length;
}
public void print(){
System.out.println("圆柱体的体积=" + this.findVolume());
}
}