public class Parallelogram { double x, y; // position double w, h; // width and height (slant) double angle; Parallelogram(double width, double height, double an){ x = 0; y = 0; w = width; h = height; angle = an; } double area(){ return w*h*Math.sin(angle); } void setPosition(double xpos, double ypos){ x = xpos; y = ypos; } double getAngle(){ return angle; } void printDetails(){ System.out.println("pos = ("+x+", "+y+"), area = "+area()); } public String toString(){ return "pos = ("+x+", "+y+"), area = "+area(); } public static void main(String args[]){ Rectangle rect1; Parallelogram plg1; rect1 = new Rectangle(20, 10); plg1 = new Parallelogram(20, 10, 1); rect1.printDetails(); plg1.printDetails(); System.out.println(rect1); System.out.println(plg1); } }