Menu
Question Index
...


Write a program to get the largest angle of a triangle by using the given points. Round the resultant angles to the nearest integer value.

Input (Point, Point, Point) Output (double)
[0, 0], [5, 0], [0, 5] 90.0
[90, 0], [0, 0], [45, 77.94] 60.0
[0, 2], [5, 0], [0, 5] 112.0
[0, 0], [10, 0], [5, 7.666] 66.0
[25, 43], [50, 0], [50, 43] 90.0

class CalculateTheLargestAngle

{    public static void main(String s[])
    {
        Point firstPoint = new Point(0, 0);
        Point secondPoint = new Point(5, 0);
        Point thirdPoint = new Point(0, 5);
        System.out.println("The largest angle of the triangle : " + getLargestAngle(firstPoint, secondPoint, thirdPoint));

    }


public static double getLargestAngle(Point firstPoint, Point secondPoint, Point thirdPoint) {
//Write code here to get the largest angle of the 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