wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes converting inputted string number to double Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
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!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: converting inputted string number to double