package com.hp.demo11.demo07; public class Circle implements Shape{ private final double PI = 3.14; private double r; @Override public double zc() { return 2*PI*r; } @Override public double mj() { return PI*r *r; } public double getR() { return r; } public void setR(double r) { this.r = r; } public Circle(double r) { this.r = r; } }
Rect
package com.hp. demo11.demo07; public class Rect implements Shape{ private double width; private double height; public double getWidth() { return width; } public void setWidth(double width) { this.width = width; } public double getHeight() { return height; } public void setHeight(double height) { this.height = height; } public Rect(double width, double height) {