Write a program to get the smallest angle of a triangle formed by the given points. Round the resultant angles to the nearest integer value.
Input (Point, Point, Point) | Output (double) |
---|---|
[0, 0], [5, 0], [0, 5] |
45.0 |
[90, 0], [0, 0], [45, 77.94] |
60.0 |
[0, 2], [5, 0], [0, 5] |
23.0 |
[0, 0], [10, 0], [5, 7.666] |
57.0 |
[25, 43], [50, 0], [50, 43] |
30.0 |
class CalculateTheSmallestAngle
{ 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 smallest angle of the triangle is : " + getSmallestAngle(firstPoint, secondPoint, thirdPoint));
}
public static double getSmallestAngle(Point firstPoint, Point secondPoint, Point thirdPoint) {
//Write code here to get the smallest angle of a 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;
}
}