class Cone<E> {  
  double height;
     E bottom;
     public Cone (E b){  
 bottom=b;   
     }
      public double computerVolume(){   
String s=bottom.toString();  
         double area=Double.parseDouble(s);
         return 1.0/3.0*area*height; 
     }
} 
class Circle{   
double area,radius; 
     Circle(double r){   
radius=r;
     } 
     public String toString(){    
area=radius*radius*Math.PI;
          return ""+area;
     }
}
class Rectangle{  
 double sideA,sideB,area; 
    Rectangle(double a,double b) {   
sideA=a; 
sideB=b;
    } 
   public String toString() { 
  area=sideA*sideB;
        return ""+area;
   }
}
public class Example6_1{ 
 public static void main(String args[]){  
       Circle circle=new Circle(10);
        Cone<Circle> coneOne=new Cone<Circle>(circle);     //创建以Circle为底的椎体对象
      coneOne.height=30;
      System.out.println(coneOne.computerVolume());
      Rectangle rect=new Rectangle(10,20);
      Cone<Rectangle> coneTwo=new Cone<Rectangle>(rect );  //创建以Rectangle为底的椎体对象
      coneTwo.height=10;
      System.out.println(coneTwo.computerVolume());
   }
}
