/* * Rectangle.cpp * * Created on: Nov 30, 2018 * Author: johnsontimoj */ // Implementation of Rectangle class #include "Rectangle.h" #include #include using namespace std; ////////////////////////////////////////////////////// // setWidth - sets the width member variable ///////////////////////////////////////////////////// void Rectangle::setWidth(double w){ if(w > 0) width = w; else{ cout << "Invalid input\n"; exit(EXIT_FAILURE); } } ////////////////////////////////////////////////////// // setLength - sets the length member variable ///////////////////////////////////////////////////// void Rectangle::setLength(double l){ if(l > 0) length = l; else{ cout << "Invalid input\n"; exit(EXIT_FAILURE); } } ////////////////////////////////////////////////////// // getWidth - gets the width member variable ///////////////////////////////////////////////////// double Rectangle::getWidth(){ return width; } ////////////////////////////////////////////////////// // get_length - gets the length member variable ///////////////////////////////////////////////////// double Rectangle::getLength(){ return length; } ////////////////////////////////////////////////////// // get_area - gets the product of width X length ///////////////////////////////////////////////////// double Rectangle::getArea(){ return width * length; }