//A more complex Rectangle class #include #include #include using namespace std; //Rectangle class declaration class Rectangle { private: double width; double length; public: Rectangle(); //constructor Rectangle(double, double); //constructor void setWidth(double); void setLength(double); double getWidth() const; double getLength() const; double area() const; bool square() const; string toString() const; }; Rectangle::Rectangle() { width=1; length=1; } //constructor Rectangle::Rectangle(double w, double l) { if(w>0) width=w; if(l>0) length=l; } //constructor void Rectangle::setWidth(double w) { if(w>0) width=w; //by making width private we can make sure that is >0 } //setWidth void Rectangle::setLength(double l) { if(l>0) length=l; } //setLength double Rectangle::getWidth() const { return width; } //getWidth double Rectangle:: getLength() const { return length; } //getWidth double Rectangle::area() const{ return width*length; } //getArea bool Rectangle::square() const{ return width==length; } //square string Rectangle::toString() const { std::ostringstream oss; //a stream to append the values oss<>wdth; myBox.setWidth(wdth); if(myBox.getWidth()!=wdth) cout<<"The value "<>lnth; myBox.setWidth(lnth); if(myBox.getLength()!=lnth) cout<<"The value "<