@@ -0,0 +1,2073 @@
+// Add more constructors to TwoDShape.%0A%0A// A class for two-dimensional objects.%0Aclass TwoDShape %7B%0A  private double width;  // these are%0A  private double height; // now private%0A  %0A  // A default constructor.%0A  TwoDShape() %7B%0A    width = height = 0.0;%0A  %7D%0A  %0A  // Parameterized constructor.%0A  TwoDShape(double w, double h) %7B%0A    width = w;%0A    height = h;%0A  %7D%0A  %0A  // Construct object with equal width and height.%0A  TwoDShape(double x) %7B%0A    width = height = x;%0A  %7D%0A  %0A  // Accessor methods for width and height.%0A  double getWidth() %7B return width; %7D%0A  double getHeight() %7B return height; %7D%0A  void setWidth(double w) %7B width = w; %7D%0A  void setHeight(double h) %7B height = h; %7D%0A  %0A  void showDim() %7B%0A    System.out.println(%22Width and height are %22 + width + %22 and %22 + height);%0A  %7D%0A%7D%0A%0A// A subclass of TwoDShape for triangles.%0Aclass Triangle extends TwoDShape %7B%0A  private String style;%0A  %0A  // A default constructor.%0A  Triangle() %7B%0A    super();%0A    style = %22null%22;%0A  %7D%0A  %0A  //Constructor%0A  Triangle(String s, double w, double h) %7B%0A    super(w, h); // call superclass constructor%0A    %0A    style = s;%0A  %7D%0A  %0A  // Construct an isoceles triangle.%0A  Triangle(double x) %7B%0A    super(x); // call superclass constructor%0A    style = %22isosceles%22;%0A  %7D%0A  %0A  double area () %7B%0A    return getWidth() * getHeight() / 2;%0A  %7D%0A  %0A  void showStyle() %7B%0A    System.out.println(%22Triangle is %22 + style);%0A  %7D%0A%7D%0A%0Aclass Shapes5 %7B%0A  public static void main(String args%5B%5D) %7B%0A    Triangle t1 = new Triangle();%0A    Triangle t2 = new Triangle(%22right%22, 8.0, 12.0);%0A    Triangle t3 = new Triangle(4.0);%0A    %0A    t1 = t2;%0A    %0A    System.out.println(%22Info for t1: %22);%0A    t1.showStyle();%0A    t1.showDim();%0A    System.out.println(%22Area is %22 + t1.area());%0A    %0A    System.out.println();%0A    %0A    System.out.println(%22Info for t2: %22);%0A    t2.showStyle();%0A    t2.showDim();%0A    System.out.println(%22Area is %22 + t2.area());%0A    %0A    System.out.println();%0A    %0A    System.out.println(%22Info for t3: %22);%0A    t3.showStyle();%0A    t3.showDim();%0A    System.out.println(%22Area is %22 + t3.area());%0A    %0A    System.out.println();%0A  %7D%0A%7D%0A

Add more constructors to TwoDShape