Program using JOptionPane??

frank3usc

Junior Member
Jan 16, 2003
16
0
0
Ok I am having to do a program with java using JOptionPane and I am a little losted really.
This is what I am having to do:Program
I have some of the formulas but don't know what to type in to make it read them. If anybody can help
my aim is mrjp11 and my icq is 168138609. Thanks
 

frank3usc

Junior Member
Jan 16, 2003
16
0
0
That is what I have so far, pretty much nothing. I have to make it echo the number i put in there and I am not sure what will do that for me. Then I have to find all the other stuff that I posted above. Any help??

/**
* radius.java
*
*
* Created: Mon Jan 27 13:34:56 2003
*
* @author <a href="mailto:Jonathan@DESKTOP"></a>
* @version
*/// Java packages
import javax.swing.JOptionPane;


public class radius{
public radius() {

}

public static void main(String[] args)
{
double raduis;//in inches
double area;//in square inches
double diameter;//in inches
double circumference;//in inches

String radiusString = JOptionPane.showInputDialog("Enter the radius of your circle in inches.");
double radius;

 

frank3usc

Junior Member
Jan 16, 2003
16
0
0
Ok got this far and getting these errors now:

/**
* radius.java
*
*
* Created: Mon Jan 27 13:34:56 2003
*
* @author <a href="mailto:Jonathan@DESKTOP"></a>
* @version
*/// Java packages
import javax.swing.JOptionPane;


public class radius{
public radius() {

}

public static void main(String[] args)
{
double raduis=0;//in inches
double area;//in square inches
double diameter;//in inches
double circumference;//in inches
String radiusString=null;
boolean flag=true; //controls the loop


do {
try{
radiusString = JOptionPane.showInputDialog("Enter the radius of your circle in inches.");
if(radiusString==null) System.exit(0);//if cancel is selected
radius=Double.parseDouble(radiusString);
flag=false;
} catch(NumberFormatException e) {
JOptionPane.showMessageDialog(null,"You entered "+radiusString+"\nPlease enter a positive number.");
}
} while(flag); //loops until a valid number is parsed
JOptionPane.showMessageDialog(null,"You entered "+radius);






}
} // radius



Errors:
CompileServer output:

c:/emacs-21.2/bin/radius.java
c:/emacs-21.2/bin/radius.java:32: cannot resolve symbol
symbol : variable radius
location: class radius
radius=Double.parseDouble(radiusString);
^
c:/emacs-21.2/bin/radius.java:38: cannot resolve symbol
symbol : variable radius
location: class radius
JOptionPane.showMessageDialog(null,"You entered "+radius);
^
2 errors

Compilation exited abnormally with code 1 at Mon Jan 27 23:40:15