aspose file tools
The moose likes Beginning Java and the fly likes converting inputted string number to double Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "converting inputted string number to double" Watch "converting inputted string number to double" New topic
Author

converting inputted string number to double

mommy6
Greenhorn

Joined: Jun 20, 2001
Posts: 2
how do I convert a string number inputted w/JOptionPane.showInputDialog into a double?
String rate;
double hrRate;
rate = JOptionPane.showInputDialog("Enter hourly rate:");
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
mommy6
1st you're going to have to change your name to comply with the naming rules of the ranch. http://www.javaranch.com/name.jsp
2nd
to convert your string to a double use the parseDouble() mehtod from the Double class. Something like this should do it for you:

hope that helps
Dave


Dave
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Try the Double class!

Manfred.
mommy6
Greenhorn

Joined: Jun 20, 2001
Posts: 2
sorry-I will change my name-Thanks for the help!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: converting inputted string number to double
 
Similar Threads
Newbie Question : cannot resolve symbol : variable
clearing the applet window
NullPointerException thrown in JOptionPane
Java beginer question
static method data validation in a dialog box app