Created
June 2, 2018 22:14
-
-
Save thmain/9e87d629debec8c4f4d21d5982c46416 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AreaOfTriangleCoordinates { | |
public static void printArea(double [] X, double [] Y){ | |
//find area of triangle | |
double area = Math.abs(X[0]*(Y[1]-Y[2]) + X[1]*(Y[2]-Y[0]) + X[2]*(Y[0]-Y[1]))/2; | |
System.out.println("Area of Triangle: " + area); | |
} | |
public static void main(String[] args) { | |
double [] x_coordinates = {1,2,5}; | |
double [] y_coordinates = {0, 6, 10}; | |
printArea(x_coordinates, y_coordinates); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment