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
posted
0
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
posted
0
Try the Double class!
Manfred.
mommy6
Greenhorn
Joined: Jun 20, 2001
Posts: 2
posted
0
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