package inheritanceAndpolymorphism;
import java.util.Scanner;
public class convexpolygonArea {
public static void main(String[] args) {
// TODO Auto-generated method stub System.out.println(“Enter the number of points:”); Scanner input=new Scanner(System.in);
int a=input.nextInt();
double[] array=new double[2a];
int k=0;
System.out.println(“Enter the coordinates of the
points”);
while(k<2a) {
double b=input.nextDouble();
array[k]=b;
k++; }
System.out.print("The total area is:"+Area(array)); }
public static double Area(double[] array) {
double area=0;
for(int i=2,k=1;k<=array.length/2-2;k++,i=i+2) { area=area+0.5(array[0]*array[i+1]+array[i]*array[i+3]+array[i+2]*array[1]-array[0]*array[i+3]-array[i]*array[1]-
array[i+2]*array[i+1]); }
return Math.abs(area); }
}