Menu
Question Index
...

Write a program to get the area of a quadrilateral. Points are given in anti clock wise direction starting from bottom left point.

Input (Point, Point, Point, Point) Output (double)
[5, 2], [10, 2], [10, 5], [5, 5] 15.0
[0, 0], [5, 0], [5, 5], [0, 5] 25.0
[5, 2], [9, 2], [9, 4], [7, 4] 6.0
[2, 1], [8, 1], [9, 8], [6, 6] 24.5
[-8, 1],  [-5, 1], [-4, 4], [-7, 4] 9.0



class AreaOfAQuadrilateral
{
    public static void main(String s[])
    {
        Point firstPoint = new Point(5, 2);
        Point secondPoint = new Point(10, 2);
        Point thirdPoint = new Point(10, 5);
        Point fourthPoint = new Point(5, 5);
        System.out.println("Area of a quadrilateral : " + areaOfAQuadrilateral(firstPoint, secondPoint, thirdPoint, fourthPoint));

    }


    public static double areaOfAQuadrilateral(Point firstPoint, Point secondPoint, Point thirdPoint, Point fourthPoint) {
    }

}
class Point {

double x;
double y;

Point(double x, double y) {
this.x = x;
this.y = y;
}
}

Doubts

Problems

Topic: Behavior Of Java Classes Using Methods

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App