import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter three points for a triangle: "); double x1 = input.nextDouble(); double y1 = input.nextDouble(); double x2 = input.nextDouble(); double y2 = input.nextDouble(); double x3 = input.nextDouble(); double y3 = input.nextDouble(); input.close(); double side1Square = (x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2); double side1 = Math.pow(side1Square, 0.5); double side2Square = (x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1); double side2 = Math.pow(side2Square, 0.5); double side3Square = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); double side3 = Math.pow(side3Square, 0.5); double s = (side1 + side2 + side3) / 2; double areaSquare = s * (s - side1) * (s - side2) * (s - side3); double area = Math.pow(areaSquare, 0.5); System.out.println("The area of the triangle is " + area); } }