Menu
Question Index
...

Write a program to find if the given points form an equilateral triangle. Compare the lenghts of the sides after rounding off to the nearest integer.

Input (Point, Point, Point) Output (boolean)
[0, 0], [50, 0], [25, 43.3] true
[0, 0], [100, 0], [50, 86.6] true
[90, 0], [0, 0], [45, 77.94] true
[-8, 4], [-4, 2], [4, -2] false
[0, -3], [3, -3], [21, -3] false



class IsAnEquilateralTriangle
{
    public static void main(String s[])
    {
        Point points1 = new Point(0, 0);
        Point points2 = new Point(50, 0);
        Point points3 = new Point(25, 43.3);
        System.out.println("Given points form an equilateral triangle : " + isAnEquilateralTriangle(points1, points2, points3));

    }


    public static boolean isAnEquilateralTriangle(Point points1, Point points2, Point points3) {
    }
    

}
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