-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTriangle.java
More file actions
57 lines (42 loc) · 1.01 KB
/
Triangle.java
File metadata and controls
57 lines (42 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
45
46
47
48
49
50
51
52
53
54
55
56
57
public class Triangle {
private Point[] points;
private Point D;
public Triangle() {
points = new Point[]{new Point(0,0), new Point(0,0), new Point(0,0)};
D = new Point(0,0);
}
public Triangle(Point A, Point B, Point C) {
points = new Point[]{A, B, C};
D = new Point(0, 0);
}
public Point[] getPoints() {
return points;
}
public Point getA() {
return points[0];
}
public Point getB() {
return points[1];
}
public Point getC() {
return points[2];
}
public Point getD() {
return D;
}
public void setA(Point A) {
points = new Point[]{A, points[1], points[2]};
}
public void setB(Point B) {
points = new Point[]{points[0], B, points[2]};
}
public void setC(Point C) {
points = new Point[]{points[0], points[1], C};
}
public void setD(Point D) {
this.D = D;
}
public String toString() {
return points[0].toString() + " " + points[1].toString() + " " + points[2].toString() + "\n" + D.toString();
}
}