Menu
Question Index
...


Write a program to find if the given points form an obtuse triangle.

Input (Point, Point, Point) Output (boolean)
[-8, 4], [-4, 2], [4, -2] true
[3, 18], [2, 14], [0, 0] true
[0, 0], [5, 0], [-1, -3] true
[50, 0], [25, 43.3], [0, 0] false
[0, 0], [-100, 0], [-50, -86.6] false

class IsAnObtuseTriangle

{    public static void main(String s[])
    {
        Point firstPoint = new Point(-8, 4);
        Point secondPoint = new Point(-4, 2);
        Point thirdPoint = new Point(4, -2);
        System.out.println("Given points form an obtuse triangle : " + isAnObtuseTriangle(firstPoint, secondPoint, thirdPoint));

    }


public static boolean isAnObtuseTriangle(Point firstPoint, Point secondPoint, Point thirdPoint) {
//Write code here to find if the given points form an obtuse triangle
}

//If required write any additional methods here
}
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