Need help with my java homework.
I need declare at least one instance variable to store the radius. Show the input dialog in method init(). Show the results in method paint(Graphics g). I have to use Joption.pane to get user input on the radius of the circle.
Then i have to use that input of radius and show the result of area,circumference. How do i do that? This is what i have so far.
public class Assign3
public void init()
String firstNumber = JOptionPane.showInputDialog(
"Enter the radius of the circle" );
double number1 = Double.parseDouble( firstNumber );
circumference = 2x( firstNumber )
area = 2xMath.PI(firstNumber)
public void paint( Graphics g )
super.paint( g );
g.drawRect( 40, 35, 270, 20 );
g.drawString( "The diameter is " + firstNumber , 25, 25 );