-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomeWork_6_4_Point.java
More file actions
58 lines (46 loc) · 1.54 KB
/
HomeWork_6_4_Point.java
File metadata and controls
58 lines (46 loc) · 1.54 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
58
package com.company;
/* 4
Design a class named Point (կետ)
properties
- coordinateX
- coordinateY
methods
- distance() (from 0:0 coordinat)
- distance(Point point) ( Overloaded method to get the distance between 2 points )
*/
public class Point {
private double coordinateX1;
private double coordinateX2;
private double coordinateY1;
private double coordinateY2;
public double getCoordinateX1() {
return coordinateX1;
}
public void setCoordinateX1(double coordinateX1) {
this.coordinateX1 = coordinateX1;
}
public double getCoordinateX2() {
return coordinateX2;
}
public void setCoordinateX2(double coordinateX2) {
this.coordinateX2 = coordinateX2;
}
public double getCoordinateY1() {
return coordinateY1;
}
public void setCoordinateY1(double coordinateY1) {
this.coordinateY1 = coordinateY1;
}
public double getCoordinateY2() {
return coordinateY2;
}
public void setCoordinateY2(double coordinateY2) {
this.coordinateY2 = coordinateY2;
}
public void distanceOfCoordinates(double coordinateX2, double coordinateY2) {
double distance = Math.sqrt(Math.pow((this.coordinateX2), 2) + Math.pow((this.coordinateY2), 2));
}
public void distanceOfCoordinates(double coordinateX1, double coordinateX2, double coordinateY1, double coordinateY2) {
double distance = Math.sqrt(Math.pow((this.coordinateX2 - this.coordinateX1), 2) + Math.pow((this.coordinateY2 - this.coordinateY1), 2));
}
}