接口问题,怎么定义一个接口里面包含计算圆的面积体积,然后定义一个圆柱体类?

这个是要求:

定义一个接口 Calculate, 包含计算圆面积的方法 getcArea()、计算体积的方法getVolume()。定义一个类 Cylinder(圆柱体),包含符号常量 PI=3.14,成员变量 r、

 

h,Cylinder 类实现了接口 Calculate,要求实例化一个 Cylinder 对象,计算输出圆柱体的体积。

麻烦了,脑袋实在有点卡壳

/*
定义一个接口Area,其中包含一个计算面积的抽象方法calculateArea(),
然后设计MyCircle和MyRectangle两个类都实现这个接口中的方法calculateArea(),`																	
分别计算圆和矩形的面积
 */
//测试类
public class Test {
	public static void main(String[] args) {
		Area a1 = new MyCircle(2.00);
		double d1 = a1.calculateArea();
		System.out.println("圆的面积为:"+d1);
        System.out.println("---------------");
		Area a2 = new MyRectangle(5.00, 6.00);
		double d2 = a2.calculateArea();
		System.out.println("矩形的面积为: "+d2);
	}
}
//定义接口Area
public interface Area {
	double calculateArea();
}
//定义圆形的类MyCircle实现Area接口
public class MyCircle implements Area {
    //定义成员变量 r 半径
	private double r;
	public MyCircle() {
		super();
	}
	public MyCircle(double r) {
		super();
		this.r = r;
	}
	public double getR() {
		return r;
	}
	public void setR(double r) {
		this.r = r;
	}
	@Override
	public double calculateArea() {
		//使用 Math类 static double PI 
        //比任何其他值都更接近 pi(即圆的周长与直径之比)的 double 值。 
		//static double pow(double a, double b) 
        //返回第一个参数的第二个参数次幂的值。 
		return Math.PI*Math.pow(r, 2);
	}
}    
//定义矩形类MyRectangle实现Area接口
public class MyRectangle implements Area {
//	定义长和宽
	private double length;
	private double	width;
	public MyRectangle() {
		super();
		// TODO Auto-generated constructor stub
	}
	public MyRectangle(double length, double width) {
		super();
		this.length = length;
		this.width = width;
	}
	public double getLength() {
		return length;
	}
	public void setLength(double length) {
		this.length = length;
	}
	public double getWidth() {
		return width;
	}
	public void setWidth(double width) {
		this.width = width;
	}
	@Override
	public double calculateArea() {
		//直接返回面积
		return length*width;
	}
}