Juicebox
03-03-2009, 07:33 PM
hey i am in a class called Computer Science and we were assigned this program to code that I have no idea how to do since my teacher apparently forgot how to teach... I'm going to post the problem and if anyone can write it up for me and email it to me i would be very very grateful. :]
"Chapter 4 Review Question 12
Use good design and programming techniques to develop a program to compute the volume of a box, cylinder, cone, and sphere. The user interface should provide option buttons to allow the user to select a shape. The interface also should include four input fields that allow a user to enter numbers with two decimal places; each input field should indicate that the input value is measured in feet.
When the user clicks a button to perform the calculation, the button's event procedure first should determine that the user selected a shape type. Next, the event procedure should ensure that only nonzero, positive values have been entered for the measurements required for the particular formula being used. Finally, the program should perform the calculation and display a message box listing the inputs, outputs, and calculated volume in a suitable format:
For example, the volume of a box wih a length of 1.00 feet, a width of 2.00 feet, and a height of 3.00 feet is 6.00 cubic feet.
Use the following formulas to determine the volumes of the various shapes:
1. Volume of a box: V = L x W x H, where L is the length, W is the width, H is the height.
2. Volume of a cylinder: V = pi x R x R x H, Where R is the radius and H is the height.
3. Volume of a cone: V = (pi x R x R x H)/3, where R is the radius of the base and H is the height.
4. Volume of a sphere: V = (4/3) x pi x R x R x R, where R is the Radius.
In all of the above formulas, use either 3.14 or the Java constant, Math.PI, for the value of pi. Your may use the Math.Pow() method for exponentiation."
If you don't mind writing this code for me I'd be very grateful :] and I'd kinda need it ASAP..
E-mail FTRJuicebox@yahoo.com
"Chapter 4 Review Question 12
Use good design and programming techniques to develop a program to compute the volume of a box, cylinder, cone, and sphere. The user interface should provide option buttons to allow the user to select a shape. The interface also should include four input fields that allow a user to enter numbers with two decimal places; each input field should indicate that the input value is measured in feet.
When the user clicks a button to perform the calculation, the button's event procedure first should determine that the user selected a shape type. Next, the event procedure should ensure that only nonzero, positive values have been entered for the measurements required for the particular formula being used. Finally, the program should perform the calculation and display a message box listing the inputs, outputs, and calculated volume in a suitable format:
For example, the volume of a box wih a length of 1.00 feet, a width of 2.00 feet, and a height of 3.00 feet is 6.00 cubic feet.
Use the following formulas to determine the volumes of the various shapes:
1. Volume of a box: V = L x W x H, where L is the length, W is the width, H is the height.
2. Volume of a cylinder: V = pi x R x R x H, Where R is the radius and H is the height.
3. Volume of a cone: V = (pi x R x R x H)/3, where R is the radius of the base and H is the height.
4. Volume of a sphere: V = (4/3) x pi x R x R x R, where R is the Radius.
In all of the above formulas, use either 3.14 or the Java constant, Math.PI, for the value of pi. Your may use the Math.Pow() method for exponentiation."
If you don't mind writing this code for me I'd be very grateful :] and I'd kinda need it ASAP..
E-mail FTRJuicebox@yahoo.com