info@meritcampus.com    +91-85006-22255
...

Write a program to get the area of a rectangle. 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
`[4, 5], [6, 5], [6, 7], [4, 7]` 4.0
`[-12, -9], [-3, -9], [-3, 0], [-12, 0]` 81.0
`[-20, 5], [-10, 5], [-10, 10], [-20, 10]` 50.0
`[8, -12], [20, -12], [20, -4], [8, -4]` 96.0

``` class AreaOfARectangle {     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 rectangle : " + areaOfARectangle(firstPoint, secondPoint, thirdPoint, fourthPoint));    }     public static double areaOfARectangle(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; } } ```
0
Wrong
Score more than 2 points