// Implementation file for the Rectangle class. // This version has a constructor that accepts arguments. #include "Rectangle.h" // Needed for the Rectangle class #include // Needed for cout #include // Needed for the exit function using namespace std; //*********************************************************** // The constructor accepts arguments for width and length. * //*********************************************************** Rectangle::Rectangle(double w, double len) { width = w; length = len; } //*********************************************************** // setWidth sets the value of the member variable width. * //*********************************************************** void Rectangle::setWidth(double w) { if (w >= 0) width = w; else { cout << "Invalid width\n"; exit(EXIT_FAILURE); } } //*********************************************************** // setLength sets the value of the member variable length. * //*********************************************************** void Rectangle::setLength(double len) { if (len >= 0) length = len; else { cout << "Invalid length\n"; exit(EXIT_FAILURE); } }