package bzu.info.software;
public class Circle {
double r,area;
public void setR(double r) {
this.r=r;
}
public double getArea() {
area=3.14*r*r;
return area;
}
public class Circle {
double r,area;
public void setR(double r) {
this.r=r;
}
public double getArea() {
area=3.14*r*r;
return area;
}
}
package bzu.info.com;
import bzu.info.software.Circle;
public class Cylinder {
Circle bottom;
double h;
void setH(double h) {
this.h=h;
}
double getVolme() {
return bottom.getArea()*h;
}
}
package bzu.info.com;
import bzu.info.software.Circle;
public class A {
public static void main(String[] args) {
Cylinder C=new Cylinder();
C.setH(2.1);
C.bottom=new Circle();
C.bottom.setR(1.0);
System.out.println("体积:"+C.getVolme());
}
}