Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

As you know from elementary geometry you can calculate the area of a triangle by oh where V is the length of the base and

image text in transcribed
As you know from elementary geometry you can calculate the area of a triangle by oh where V is the length of the base and h is the length of the height of the triangle. If you do not know the height of the triangle and just know the lengths of the three sides you can use Heron's formula. Heron's formula states that given the lengths of the sides of the triangle (a, b, and c) we can calculate its arca by A = Vpp-a)p-6)(p-c) where p is the semi-perimeter of the triangle p = }(a+b+c). Note that to take a square root in Java use the command Math.sqrt(x). So the following command will store the square root of the value of the variablet into the variable root double root = Math. sqrt(1); You can put any valid expression inside the square root as well, so for example root = Math.sqrt(15.8t + 27.9/y + 4.2): is a valid assignment statement. B 1 0 Write a program that asks the user to input three integers as the side lengths of the triangle then outputs the area. You should try the following sample run. Input the length of side A: 4 Input the length of side B: 5 Input the length of side C: 7 The area is = 9.797958971132712

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

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions