（1）图形（TuXing）类，只有一个图形名称属性以及获取、设置属性值的方法，其源代码如下：
package ch06_14;
public class TuXing {
	private String mingCheng;
	public TuXing(String mingCheng) {
		this.mingCheng = mingCheng;
	}
	public TuXing() {
		this.mingCheng = "无名";
	}
	public String getMingCheng() {
		return mingCheng;
	}
	public void setMingCheng(String mingCheng) {
		this.mingCheng = mingCheng;
	}
}
（2）继承TuXing类并实现接口Icalculate创建圆柱类（YuanZhu），其源代码如下：
package ch06_14;
import ch06_10.ICalculate;
public class YuanZhu extends TuXing implements ICalculate {
	private double r;
	private double h;
	public YuanZhu( double r, double h) {
		super("圆柱");
		this.r = r;
		this.h = h;
	}
	public YuanZhu() {
		super("点");
		this.r=0;
		this.h=0;
	}
	public YuanZhu(double r) {
		super("圆");
		this.r=r;
		this.h=0;
	}
	@Override
	public double getArea() {//圆的面积
		return PI*r*r;
	}
	@Override
	public double getCircumference() {//圆的周长
		return 2*PI*r;
	}
	@Override
	public void javaOut() {
		System.out.println(getMingCheng()+"信息：半径="+r+" 高="+h+" 表面积="+bmj()+" 体积="+tj());
	}
	public double tj(){//圆柱的体积
		return getArea()*h;
	}
	public double bmj(){//圆柱的表面积
		return getCircumference()*h+2*getArea();
	}
}
（3）主类
package ch06_14;
public class TestMain {
	public static void main(String[] args) {
		YuanZhu yz1=new YuanZhu();
		YuanZhu yz2=new YuanZhu(10);
		YuanZhu yz3=new YuanZhu(10,100);
		yz1.javaOut();
		yz2.javaOut();
		yz3.javaOut();
	}
}
