-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwork2.cpp
More file actions
43 lines (38 loc) · 754 Bytes
/
Copy pathwork2.cpp
File metadata and controls
43 lines (38 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
using namespace std;
class Rectangle
{
private:
double length;
double width;
public:
Rectangle(double Length=10,double Width=5);
double Area() const;
double Perimeter() const;
};
Rectangle::Rectangle(double Length,double Width)
{
length = Length;
width = Width;
}
double Rectangle::Area() const
{
return length * width;
}
double Rectangle::Perimeter() const
{
return 2 * (length + width);
}
int main()
{
double l, w, s1, s2, c, m;
cin >> l >> w;
Rectangle rect1(l,w);
Rectangle rect2(l + 3, w + 3);
s1 = rect1.Area();
s2 = rect2.Area() - s1;
m = s2 * 240;
c = rect2.Perimeter()*50;
cout << c << endl;
cout << m << endl;
}