Explore BrainMass
Share

Hypotenuse of a Triangle using Pythagorean Theorem in VB

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

Calculate the hypotenuse of a right-angled triangle. The Pythagorean theorem. The application should also allow the user to perform a cylinder volume calculation.

Pythagorean theorem formula:
a2 + b2 = c2

Cylinder volume formula:
Cylinder volume = r2 h

Allow the user to enter the value of "a" and the value of "b" to calculate c2.
Use NumericUpdown controls for both a and b to allow the user to enter the values.
Use NumericUpdown controls to enter the value of "r" and "h" in the cylinder volume calculation.
Display the result in a text box and set it as read-only.
Create a group box with two radio buttons that would allow the user to select which calculation to perform (Pythagorean theorem or cylinder volume).
Make the Calculate button the Accept button.
Create a Clear button that will clear the result text box and reset both NumericUpdown controls.
Create an Exit button.
Use labels to identify the input and output controls and change the label text value according to the radio button selected.

© BrainMass Inc. brainmass.com December 19, 2018, 11:20 pm ad1c9bdddf
https://brainmass.com/math/trigonometry/hypotenuse-of-a-triangle-using-pythagorean-theorem-in-vb-116696

Solution Preview

The problem requires you to find:
a) the Hypotenuse of a Right-Angled Triangle given its two right-angled sides a and b.
b) the volume of a cylinder given it's radius ...

Solution Summary

Solution shows in Visual Basic (VB), how to calculate the hypotenuse of a right-angled triangle using the Pythagorean theorem. The application also allows the user to perform cylinder volume calculations.
The problem requires you to find:
a) the Hypotenuse of a Right-Angled Triangle given its two right-angled sides a and b.
b) the volume of a cylinder given it's radius r and height h.

The attached solution will show you how to:
1) create a vb GUI interface (form) to place the appropriate NumericUpDown controls
2) Take input for two different functions (a and b) from the same set of NumericUpDown controls with
3) the use of Radio buttons for function selection in a group box, and
4) how to change the label and output information for the output display textbox
5) consider when a triangle is invalid

The code has been extensively commented, so that you can understand.

$2.19