Question: JAVA PROGRAM Under the (AreaOfTriangle.java) class write the method: public static double areaOfTriange(double base, double height) Write a method called areaOfTriangle that returns the area

JAVA PROGRAM

Under the (AreaOfTriangle.java) class write the method: public static double areaOfTriange(double base, double height)

Write a method called areaOfTriangle that returns the area of a triangle as a real number. The method should take two parameters that are double numbers, namely base and height. Assume that the inputs are always positive numbers. The formula for the area of a triangle is 1/2bh. Also write a main method that accepts the input for base and height from the user through keyboard and invokes the method areaOfTriange(double base, double height). Print the area of the triangle.

Here are some sample runs:

Enter the values of base and height: 15 8

Are of this triangle with base 15 and height 8 is: 60.0

Enter the values of base and height: 12.2 10.9

Are of this triangle with base 12.2 and height 10.9 is: 66.49

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!