Explore BrainMass
Share

# Compute the volume of a box, cylinder, and sphere

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

The selection of which calculation to make should be made from a ComboBox Control. The application should include four input fields that allows a user to enter numbers with two decimal places; each input field also should indicate that the input value is measured in feet. Label the four input fields as: Length, Width, Height, and Radius. When the user clicks a button to perform the calculation, the button's event procedure should first determine that a selection for the calculation type was made. Next, the event procedure should ensure that non-zero, positive values have been entered only for the measurements needed for the particular formula being used. Finally, the calculation should be performed and a message box displayed to indicate the inputs and output in the following format:

The volume of a box with a length of 1.00 feet, a width of 2.00 feet, and a height of 3.00 feet has a volume of 6.00 cubic feet.

Use the following formulas to determine the volumes of various shapes:

1. Volume of a box: V = L x W x H where L is the Length, W is the width, and H is the height of the box
2. Volume of a cylinder: V = pi x R x R x H, where R is the radius, and H is the height of the cylinder
3. Volume of a cone: V = (pi x R x R H)/3, where R is the radius of the base, and H is the height of the cone
4. Volume of a sphere: V = 4 x pi x R * R x R/3, where R is the radius of the sphere

In all of the above formulas, use the .NET framework class linrary constant, Math.PI, for the calue of pi.