Menu
Question Index
...

Write a program to get the area of a triangle.

Input (Point, Point, Point) Output (double)
[0, 0], [5, 0], [5, 5] 12.5
[-7, 0], [3, 0], [3, 10] 50.0
[2, 2], [6, 2], [6, 6] 8.0
[3, 1], [1.5, 1.2], [2.5, 4.3] 2.425
[-2, 0], [1, 0], [0, -3] 4.5



class AreaOfATriangle
{
    public static void main(String s[])
    {
        Point firstPoint = new Point(0, 0);
        Point secondPoint = new Point(5, 0);
        Point thirdPoint = new Point(5, 5);
        System.out.println("Area of a triangle : " + areaOfATriangle(firstPoint, secondPoint, thirdPoint));

    }


    public static double areaOfATriangle(Point firstPoint, Point secondPoint, Point thirdPoint) {
    }
    

}
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