-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPoint.java
More file actions
57 lines (43 loc) · 848 Bytes
/
Point.java
File metadata and controls
57 lines (43 loc) · 848 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
44
45
46
47
48
49
50
51
52
53
54
55
56
//this class represent a singal polynom instance.
public class Point {
private double x;
private double y;
//default constructor
public Point() {
this.x = 0;
this.y = 0;
}
//costume constructor
public Point(double x, double y) {
this.x = x;
this.y = y;
}
//copy constructor
public Point(Point c) {
this.x = c.getX();
this.y = c.getY();
}
public double getX() {
return this.x;
}
public double getY() {
return this.y;
}
public void setX(double x) {
this.x = x;
}
public void setY(double y) {
this.y = y;
}
public boolean isEqualTo(Point p)
{
if(this.x == p.getX() && this.y == p.getY())
return true;
else return false;
}
//stringing the instance by formal presentation rules
public String toString()
{
return "(" + this.x + "," + this.y + ")"; //"(x,y)"
}
}