public class Rectangle implements Measurable
1: package interfaces;
3: // Rectangle.java
4: // a class that implements Measurable
5: // See also:
6: // Measurable.java
7: // Circle.java
9: public class Rectangle implements Measurable {
11: private double length, width;
13: public Rectangle(double l, double w) {
14: length = l;
15: width = w;
16: }
18: public double getLength() {
19: return length;
20: }
22: public double getWidth() {
23: return width;
24: }
26: @Override
27: public double getArea() {
28: return length * width;
29: }
31: @Override
32: public double getPerimeter () {
33: return 2 * (length + width);
34: }
36: }