@@ -0,0 +1,1123 @@
+%0Apackage ru.ematveev.point;%0A%0Aimport java.lang.Math.*;%0A%0A%0A%09public class Point %7B%0A%09%09public double x;%0A%09%09public double y;%0A%0A%09public Point(double x, double y) %7B%0A%09%09%09this.x = x;%0A%09%09%09this.y = y;%0A%09%7D%0A%0A%09public double distanceTo(Point point) %7B%0A%09%09//calculate distance between two points%0A%0A%09%09%09%09double l1 = this.x - point.x;%0A%09%09%09%09double l2 = this.y - point.y;%0A%09%0A%0A%09%09%09%09double l = Math.sqrt(Math.pow(l1, 2) + Math.pow(l2, 2));%0A%0A%09%09%09return l; %0A%0A%09%7D%09%0A%0A%7D%0A%09%0Apublic class Triangle %7B%0A%09%09%09public Point a;%0A%09%09%09public Point b;%0A%09%09%09public Point c;%0A%0A%09public Triangle(Point a, Point b, Point c) %7B%0A%09%09%09this.a = a;%0A%09%09%09this.b = b;%0A%09%09%09this.c = c;%0A%09%7D%0A%0A%09public double area() %7B%0A%09%09//calculate the triangle area%0A%0A%09%09%09%09double ab = a.distanceTo(b);%0A%09%09%09%09double bc = b.distanceTo(c);%0A%09%09%09%09double ca = c.distanceTo(a);%0A%0A%09%09%09%09double d = (ab + bc + ca)/2;%0A%09%09%09%09double s = Math.sqrt(d*(d-ab)*(d-bc)*(d-ca));%0A%0A%09%09%09%09if (s %3E 0)%0A%0A%09%09%09%09%09return s;%0A%0A%09%09%09%09else %0A%0A%09%09%09%09%09return -1;%0A%09%09%7D%0A%09%09%09%0A%7D%0A%0Apublic class Main%7B%0A%09%09%09%09%09%0A%09public static void main ( String%5B%5D args )%7B%0A%0A%09%09%09Point a = new Point();%0A%09%09%09Point b = new Point();%0A%09%09%09Point c = new Point();%0A%0A%09%09%09double area = new Triangle(a, b, c).area();%0A%0A%0A%09%7D%0A%09%09%0A%7D%0A%0A

add file Point.java