#include <iostream>
#include <iomanip>
using namespace std;
class Rectangle
{
public:
Rectangle() :length(1), width(1){}
void setLength(double a)
{
if (0.0 < a && a < 20.0)
length = a;
else
length = 1;
}
void setWidth(double a)
{
if (0.0 < a && a < 20.0)
width = a;
else
width = 1;
}
double getLength() const { return length; }
double getWidth() const { return width; }
double perimeter() const { return (length + width)*2.0; }
double area() const { return length * width; }
protected:
double length, width;
};
//StudybarCommentBegin
int main()
{
Rectangle r;
double length, width;
// cout<<"please input the length of Rectangle:";
cin >> length;
// cout<<"please input the width of Rectangle:";
cin >> width;
r.setLength(length);
r.setWidth(width);
cout << "the perimeter is:" << setprecision(2) << fixed << r.perimeter() << endl;
cout << "the area is:" << setprecision(2) << fixed << r.area() << endl;
return 0;
}
//StudybarCommentEnd