|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help needed on Java Assignment.
Anyone can help me with this?
Write a complete Java application which prompts the user for the int radius of a sphere, and call method sphereVolume to calculate and display the volume of that sphere (there is NO return value required), using the formula:volume = ( 4.0 / 3.0 ) * Math.PI * Math.pow( radius, 3 ). The user should input the radius through the inputRadius method and RETURN the value of radius. Thanks |
|
#2
|
|||
|
|||
|
well create a jframe with the textfield
Enter Radus:_________ and another textfield SphereVolume________(a) (to show answer ;would be good to make it uneditable) make a JButton called "Calculate" (answer) ,add an actionlistener to the button when clicked void parse() { a function to parse the inputted radius in inches } actionPerformed( event .evt ) { if( evt.getSource == Calculated) { private void calc(int/float x) { answer= calculations here using the variable (parsed x) } } } thats about the gist of what your program should do, assuming you know how to create JButtons, JFormattedTextfields, parse functions and actionlisteners |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > Help needed on Java Assignment. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|