public class Rectangle {
Line width, height;
public Rectangle(final Point start1, final Point start2, final Point end1,
final Point end2) {
width = new Line(start1, end1);
height = new Line(start2, end2);
}
public Rectangle(final Line width, final Line height) {
this.width = width;
this.height = height;
}
public Rectangle(final Rectangle rec) {
this.width = rec.width;
this.height = rec.height;
}
public double area() {
return width.length() * height.length();
}
}
No comments:
Post a Comment