1 public class Rectangle extends Parallelogram { 2 3 // Class variable: 4 protected final static double rightAngle = Math.PI/2; 5 6 // Constructors: 7 public Rectangle(double width, double height) { 8 super.setWidth(width); super.setHeight(height); 9 super.setAngle(rightAngle); 10 } 11 public Rectangle(Dimension d) { 12 super.setDimension(d); super.setAngle(rightAngle); 13 } 14 public Rectangle() { } 15 16 // Encapsulate the instance variables: 17 public void setWidth(double width) { 18 super.setWidth(width); 19 super.setAngle(rightAngle); 20 } 21 public void setHeight(double height) { 22 super.setHeight(height); 23 super.setAngle(rightAngle); 24 } 25 public void setDimension(double width, double height) { 26 super.setDimension(width, height); 27 super.setAngle(rightAngle); 28 } 29 public void setDimension(Dimension d) { 30 super.setDimension(d); 31 super.setAngle(rightAngle); 32 } 33 34 }