Implement methods for class called Rectangle

I need help finishing this program. I keep getting an error that says "[Error] expected initializer before 'bool'.
Here's the program:

#include <iostream>
#include <iomanip>

using namespace std;

//Place the class definition after this line
class Rectangle
{
public:
Rectangle( int, int );

void print();

void setWidth( int );
void setHeight( int );

int getWidth();
int getHeight();

int calcArea();

bool isSquare();

private:
int width, height;
};


int main()
{
int testNum =1;

cout << "Test " << testNum++ << ": the constructor and print method" << endl;

//Create two objects
Rectangle rec1(0, 0);
Rectangle rec2(12, 5);

//Display the two objects by calling the print method.

cout << endl << "Rectangle 1:" << endl;
rec1.print();

cout << endl << "Rectangle 2:" << endl;
rec2.print();


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;


cout << endl << endl << "Test " << testNum++ << ": the calcArea method" << 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;


cout << endl << endl << "Test " << testNum++ << ": the isSquare method" << endl;

//Display all three of the Rectangle objects
cout << endl << "Rectangle 1:" << endl;
rec1.print();

cout << endl << "Rectangle 2:" << endl;
rec2.print();

cout << endl << "Rectangle 3:" << endl;
rec3.print();

//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

/*
cout << endl << endl << endl
<< "EXTRA CREDIT Test " << testNum++ << ": the draw method" << endl;

cout << endl << "Rectangle 1:" << endl;
rec1.print();
rec1.draw();

cout << endl << "Rectangle 2:" << endl;
rec2.print();
rec2.draw();

cout << endl << "Rectangle 3:" << endl;
rec3.print();
rec3.draw();
*/

return 0;
}


//Code the methods below this line
void print();
void setWidth( int newWidth);
void setHeight( int newHeight);
int getWidth();
int getHeight();
int calcArea()
bool isSquare();
Can you post your .cpp file for the class Rectangle.
Here you go:
Topic archived. No new replies allowed.