
Patrick B. answered 03/31/21
Math and computer tutor/teacher
//YOUR_CODE
Rectangle::Rectangle(double theWidth, double theHeight)
{
this->width = theWidth;
this->height = theHeight;
}
double Rectangle::getWidth() { return(width); }
double Rectangle::getHeight() { return(height); }
double Rectangle::getPerimeter() { return (2*height+2*width); }
double Rectangle::getArea() { return(height*width); }
void Rectangle::scale(double scaleFactor)
{
if (scaleFactor>0)
{
width *= scaleFactor; height*=scaleFactor;
}
else
{
//need to set an error flag here or return some negative value
}
}
//YOUR_CODE_ABOVE