Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions