Menu
Question Index
...

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

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



class IsATrapezoid
{
    public static void main(String s[])
    {
        Point firstPoint = new Point(5, 2);
        Point secondPoint = new Point(9, 2);
        Point thirdPoint = new Point(9, 4);
        Point fourthPoint = new Point(7, 4);
        System.out.println("Is a trapezoid : " + isATrapezoid(firstPoint, secondPoint, thirdPoint, fourthPoint));

    }


    public static boolean isATrapezoid(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