public class Parallelogram3 extends Rectangle { // We extend the rectangle class // Hence we "inherit" a copy of Rectangle variables double angle; Parallelogram3(double width, double height, double an){ super(width, height); angle = an; } // We redefine or "override" area() double area(){ return super.area()*Math.sin(angle); } // We don't need to define setposition! // we don't need to define printDetails! // Note that the above definition of printDetail() // picks up the new definition of area()! double getAngle(){ return angle; } public static void main(String args[]){ Rectangle rect1; Parallelogram plg1; Parallelogram2 plg2; Parallelogram3 plg3; rect1 = new Rectangle(20, 10); plg1 = new Parallelogram(20, 10, 1); plg2 = new Parallelogram2(20, 10, 1); plg3 = new Parallelogram3(20, 10, 1); rect1.printDetails(); plg1.printDetails(); plg2.printDetails(); plg3.printDetails(); } }