cout << endl << endl << "Test " << testNum++ << ": the set methods" << endl;
//use valid values to set the width and height of the first Rectangle object
rec1.setWidth(30);
rec1.setHeight(15);
//display the first rectangle
cout << endl << "Rectangle 1:" << endl;
rec1.print();
//use negative values with the second Rectangle object. This should result in
//the use of default values.
rec2.setWidth(-5);
rec2.setHeight(-10);
//display the second rectangle
cout << endl << "Rectangle 2:" << endl;
rec2.print();
//Create a third Rectangle object using values that are too large. This
//should result in the use of default values and make sure that the
//constructor is calling the set methods
Rectangle rec3 = Rectangle(99, 99);
//display the third rectangle
cout << endl << "Rectangle 3:" << endl;
rec3.print();
cout << endl << endl << "Test " << testNum++ << ": the get methods" << endl;
//Call the get methods and display the values for the first and second
//rectangle
cout << endl << "For rectangle 1, the width is " << rec1.getWidth()
<< " and the height is " << rec1.getHeight() << "." << endl;
cout << endl << "For rectangle 2, the width is " << rec2.getWidth()
<< " and the height is " << rec2.getHeight() << "." << endl;
//Change the width and height of the third rectangle and then display
rec3.setWidth(5);
rec3.setHeight(5);
cout << endl << "For rectangle 3, the width is " << rec3.getWidth()
<< " and the height is " << rec3.getHeight() << "." << endl;
//Display the area for all three of the Rectangle objects
cout << endl << "The area of rectangle 1 is " << rec1.calcArea() << endl
<< endl << "The area of rectangle 2 is " << rec2.calcArea() << endl
<< endl << "The area of rectangle 3 is " << rec3.calcArea() << endl;
//Determine if any of the Rectangle objects are square
if( rec1.isSquare() )
{
cout << endl << "Rectangle 1 is a square.";
}
else
{
cout << endl << "Rectangle 1 is not a square.";
}
if( rec2.isSquare() )
{
cout << endl << "Rectangle 2 is a square.";
}
else
{
cout << endl << "Rectangle 2 is not a square.";
}
if( rec3.isSquare() )
{
cout << endl << "Rectangle 3 is a square.";
}
else
{
cout << endl << "Rectangle 3 is not a square.";
}
//The test of the extra credit method is below. Remove the /* and */
//if attempting the extra credit
//Code the methods below this line
void print();
void setWidth( int newWidth);
void setHeight( int newHeight);
int getWidth();
int getHeight();
int calcArea()
bool isSquare();