Challenge: Calculating Area

Let's calculate the area of a triangle by defining a class in this challenge.

Problem statement

Let’s start with a very basic example.

Write a package called Triangle having two public variables for length and height and one member method called area which will return the area of the right angle triangle. You can calculate the area of a triangle using

Area=1/2(length)(height)Area = 1/2(length)(height)

Input

Two variables (integer or float) as the dimensions of the triangle.

Output

Area of that triangle.

Sample input

4, 5

Sample output

10

Coding challenge

Write your code below. It is recommended​​ that you try solving the exercise yourself before viewing the solution.

Good Luck!

package Triangle;
# implement sub new method which initialize len and height of triangle
# implement sub area method which return area of triangle
# make an object of triangle and then call area method from the triangle object