Ok, this is where I'm at now:
Code://this is my coding #include <iostream> #include <iomanip> using namespace std; class rectangle { private: double Width, Lenght; public: rectangle () {Width = 1.0, Lenght = 1.0;}; rectangle (double,double); double area (void) const {return (Width*Lenght);} double perimeter (void) const {return (Lenght*2 + Width*2);} void setWidth(double x); void setLenght(double y); double getWidth() const; double getLenght() const; }; void rectangle::setWidth(double x;) { if ((x < 0.0;) || (x > 20.0;)) { Width = 1.0; } Width = x; } void rectangle::setLenght(double y;) { if ((y < 0.0;) || (y > 20.0;)) { Lenght = 1.0; } Lenght = y; } int rectangle::getWidth() { return Width; } int rectangle::getLenght() { return Lenght; } //this is what was given int main() { rectangle a, b(4.0,5.0), c(67.0, 888.0); cout<< setiosflags(ios::fixed | ios::showpoint); cout<<setprecision(1); cout<<"a: length = " << a.getLenght() << "; width = " << a.getWidth() << "area = " << a.area() <<'\n'; cout<< "b: length = " << b.getLenght() << "; width = " << b.getWidth() << "; perimeter = " << b.perimeter() << "; area = " << b.area() << '\n'; cout << "c: length = " << c.getLenght() << "; width = " << c.getWidth() << "; perimeter =" << c.perimeter() << "; area = " << c.area() << endl; return 0; }
ERRORS
C:\Documents and Settings\Chris\Cpp1.cpp(24) : error C2143: syntax error : missing ')' before ';'
C:\Documents and Settings\Chris\Cpp1.cpp(24) : error C2059: syntax error : ')'
C:\Documents and Settings\Chris\Cpp1.cpp(25) : error C2447: missing function header (old-style formal list?)
C:\Documents and Settings\Chris\Cpp1.cpp(35) : error C2143: syntax error : missing ')' before ';'
C:\Documents and Settings\Chris\Cpp1.cpp(35) : error C2059: syntax error : ')'
C:\Documents and Settings\Chris\Cpp1.cpp(36) : error C2447: missing function header (old-style formal list?)
C:\Documents and Settings\Chris\Cpp1.cpp(46) : error C2511: 'getWidth' : overloaded member function 'int (void)' not found in 'rectangle'
C:\Documents and Settings\Chris\Cpp1.cpp(8) : see declaration of 'rectangle'
C:\Documents and Settings\Chris\Cpp1.cpp(57) : error C2511: 'getLenght' : overloaded member function 'int (void)' not found in 'rectangle'
C:\Documents and Settings\Chris\Cpp1.cpp(8) : see declaration of 'rectangle'