package bzu.info.software;
public class Circle {
public double radius;
public void setR(double r){
this.radius = r;
}
public double getS(){
return radius*radius*3.14;
}
public class Circle {
public double radius;
public void setR(double r){
this.radius = r;
}
public double getS(){
return radius*radius*3.14;
}
}
package bzu.info.com;
import bzu.info.software.Circle;
public class Cylinder {
Circle circle;
double h;
void setH(double h){
this.h = h;
}
void setR(Circle c){
this.circle = c;
}
void show(){
System.out.println("体积为"+circle.getS()*h);
}
}
package bzu.info.com;
import bzu.info.software.Circle;
public class A {
public static void main(String[] args) {
Circle c = new Circle();
c.setR(3.1);
Cylinder cy = new Cylinder();
cy.setR(c);
cy.setH(2.3);
cy.show();
}
}