Menu
Question Index
...

Write a program to find if the given points form a parallelogram. Points are given in anti clock wise direction starting from bottom left point.

Input (Point, Point, Point, Point) Output (boolean)
[4, 2], [6, 3], [6, 5], [4, 4] true
[0, 0], [5, 0], [8, 4], [3, 4] true
[-2, -2], [2, -2], [2, 0], [-2, 0] true
[5, 2], [9, 2], [9, 4], [7, 4] false
[2, 1], [8, 1], [9, 8], [6, 6] false



class IsAParallelogram
{
    public static void main(String s[])
    {
        Point firstPoint = new Point(4, 2);
        Point secondPoint = new Point(6, 3);
        Point thirdPoint = new Point(6, 5);
        Point fourthPoint = new Point(4, 4);
        System.out.println("Is a parallelogram : " + isAParallelogram(firstPoint, secondPoint, thirdPoint, fourthPoint));

    }


    public static boolean isAParallelogram(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: Java Multiple Methods In One Class

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App