1 / 4
文档名称:

圆柱体梯形柱体接口.doc

格式:doc   大小:25KB   页数:4页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

圆柱体梯形柱体接口.doc

上传人:xgs758698 2018/11/14 文件大小:25 KB

下载得到文件列表

圆柱体梯形柱体接口.doc

文档介绍

文档介绍:{
public static void main(String [] args)
{
Pillar pillar;
Geometry tuXing;
Circle circle = new Circle(new Double(10));
tuXing = circle;
("半径是:" + ().doubleValue()+"的面积是" + ().doubleValue());
pillar = new Pillar(circle,new Double(58));
("底面半径是:%f的圆,高是:%f的圆柱体体积是:%f",().doubleValue()
,().doubleValue(),
().doubleValue());
Lader lader = new Lader(new Double(12),new Double(22),new Double(100));
tuXing = lader;
(tuXing);
("%n上底:%f,下底:%f,高:%f的梯形面积是:%f",().doubleValue()
,().doubleValue()
,().doubleValue()
,().doubleValue());
("%n上底、下底、高分别是:%f%f%f的梯形底,柱高是:%f的柱体体积是:%f",().doubleValue()
,().doubleValue()
,().doubleValue()
,().doubleValue()
,().doubleValue());
}
}
interface Geometry
{
public abstract Double getArea();
}
class Pillar
{
Geometry bottom;
Double height;

Pillar()
{
bottom = null;
height = new Double(0);
}

Pillar(Geometry bottom,Double height)
{
= bottom;
= height;
}

public void setBottom(Geometry bottom)
{
= bottom;
}

public Geometry getBottom()
{
return bottom;
}

publi