public class Parallelogram extends Polygon { // Instance variables: protected double width, height, angle; // Constructors: public Parallelogram(double width, double height, double angle) { setWidth(width); setHeight(height); setAngle(angle); } public Parallelogram(Dimension d, double angle) { setDimension(d); setAngle(angle); } public Parallelogram() { } // Encapsulate the instance variables: public void setWidth(double width) { this.width = width; } public void setHeight(double height) { this.height = height; } public void setDimension(double width, double height) { setWidth(width); setHeight(height); } public void setDimension(Dimension d) { setWidth(d.width); setHeight(d.height); } public void setAngle(double angle) { this.angle = angle; } public double getWidth() { return width; } public double getHeight() { return height; } public Dimension getDimension() { return new Dimension(width, height); } public double getAngle() { return angle; } // Instance methods: public double perimeter() { return 2*(width + height); } public double area() { return width*height*Math.sin(angle); } }