-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrectangle
More file actions
44 lines (36 loc) · 1.01 KB
/
Copy pathrectangle
File metadata and controls
44 lines (36 loc) · 1.01 KB
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
44
using System;
class Program
{
static void Main()
{
Rectangle myRectangle = new Rectangle(12,9,7,4);
}
public class Rectangle
{
int rightBottomPoint;
int leftBottomPoint;
int rightTopPoint;
int leftTopPoint;
public Rectangle(int x1, int x2,int y1,int y2)
{
this.rightBottomPoint=x1;
this.leftBottomPoint=x2;
this.rightTopPoint = y1;
this.leftTopPoint = y2;
GetDistance();
}
void GetDistance()
{
Console.WriteLine(Perimetr((leftBottomPoint-leftTopPoint),(rightBottomPoint-rightTopPoint)));
Console.WriteLine(Square((leftBottomPoint-leftTopPoint),(rightBottomPoint-rightTopPoint)));
}
double Perimetr (double a, double b)
{
return (a*2+b*2);
}
double Square (double a, double b)
{
return a*b;
}
}
}