javabook
Class SimpleInput

java.lang.Object
  |
  +--javabook.SimpleInput

public class SimpleInput
extends java.lang.Object

Provides a simple input routine for non-GUI programs. Supports reading integers, real numbers, and strings.


Constructor Summary
SimpleInput()
           
 
Method Summary
static double getDouble()
          Reads in a double using a default prompt text.
static double getDouble(java.lang.String text)
          Reads in a double using the second parameter as its prompt text.
static float getFloat()
          Reads in a float using a default prompt text.
static float getFloat(java.lang.String text)
          Reads in a float using the second parameter as its prompt text.
static int getInteger()
          Reads in an integer using a default prompt text.
static int getInteger(java.lang.String text)
          Reads in an integer using the second parameter as its prompt text.
static java.lang.String getString()
          Reads in a String using a default prompt text.
static java.lang.String getString(java.lang.String text)
          Reads in a String using the second parameter as its prompt text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleInput

public SimpleInput()
Method Detail

getDouble

public static double getDouble()
Reads in a double using a default prompt text. Does not terminate until the user enters a valid double.
Returns:
a double value entered by the user.

getDouble

public static double getDouble(java.lang.String text)
Reads in a double using the second parameter as its prompt text. Does not terminate until the user enters a double.
Returns:
a double value entered by the user.

getFloat

public static float getFloat()
Reads in a float using a default prompt text. Does not terminate until the user enters a valid float.
Returns:
a float value entered by the user.

getFloat

public static float getFloat(java.lang.String text)
Reads in a float using the second parameter as its prompt text. Does not terminate until the user enters a valid float.
Returns:
a float value entered by the user.

getInteger

public static int getInteger()
Reads in an integer using a default prompt text. Does not terminate until the user enters a valid integer.
Returns:
an int value entered by the user.

getInteger

public static int getInteger(java.lang.String text)
Reads in an integer using the second parameter as its prompt text. Does not terminate until the user enters a valid integer.
Returns:
an int value entered by the user.

getString

public static java.lang.String getString()
Reads in a String using a default prompt text.
Returns:
a String value entered by the user.

getString

public static java.lang.String getString(java.lang.String text)
Reads in a String using the second parameter as its prompt text.
Returns:
a String value entered by the user.