
-----------------------------------
princess
Wed Feb 11, 2004 7:55 pm

input from the user
-----------------------------------
i noe how to get numbers from the user.... but those numbers are only integers how can i make them numbers wit decimals?

-----------------------------------
Paul
Wed Feb 11, 2004 7:57 pm


-----------------------------------
use double or floot type variables.

-----------------------------------
princess
Wed Feb 11, 2004 7:59 pm


-----------------------------------
.... ya but how do u change the input from a string to a double??

-----------------------------------
Paul
Wed Feb 11, 2004 8:01 pm


-----------------------------------
Double.parseDouble or something like that, i forgot the exact cases.

-----------------------------------
princess
Wed Feb 11, 2004 8:06 pm


-----------------------------------
alrite thanx i'll try it

-----------------------------------
Homer_simpson
Wed Feb 11, 2004 9:20 pm


-----------------------------------
use JOption.ShowInputDialog

-----------------------------------
Paul
Wed Feb 11, 2004 9:59 pm


-----------------------------------
That can only input string I though, or if Im mistaken I have to change the tutorial. You still end up use Double.parseDouble.

-----------------------------------
Homer_simpson
Thu Feb 12, 2004 7:33 pm


-----------------------------------
yeah... why dont u just parse it in?

-----------------------------------
wtd
Thu Feb 12, 2004 9:37 pm


-----------------------------------
It's not tested, but...

import java.lang.*;
import java.io.*;
import java.util.*;

class Test
{
   public static void main(String[] args)
   {
      BufferedReader keyboard = new BufferedRead(
         new InputStreamReader(System.in));

      // read in a line
      String userInput = keyboard.readLine();
      
      // store the double input
      doube parsedUserInput = Double.parseDouble(userInput);

      // do something with the double
   }
}
