Answer to Question #269168 in Visual Basic for mike

Question #269168

Hypotenuse Calculations) Define a method hypotenuse that calculates the hypotenuse of a right triangle when the lengths of the other two sides are given. The method should take two arguments of type double and return the hypotenuse as a double. Incorporate this method into an application that reads values for sidel and side 2 and performs the calculation with the hypotenuse method. Use Math methods pow and sqrt to determine the length of the hypotenuse for each of the triangles in Fig. $6.15 .[$ Note: Class Math also provides method hypot to perform this calculation.]

1
Expert's answer
2021-11-21T17:34:28-0500
Imports System.IO


Module Module1
    Sub Main()
        Console.Write("Enter side 1: ")
        Dim side1 As Double = Double.Parse(Console.ReadLine())
        Console.Write("Enter side 2: ")
        Dim side2 As Double = Double.Parse(Console.ReadLine())
        Console.WriteLine("Hypotenuse: {0}", calculatesHypotenuse(side1, side2))
        Console.ReadLine()
    End Sub
    Function calculatesHypotenuse(ByVal side1 As Double, ByVal side2 As Double)
        Return Math.Sqrt(Math.Pow(side1, 2) + Math.Pow(side2, 2))
    End Function


End Module

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS