public class Input
extends java.lang.Object
Constructor and Description |
---|
Input()
Create a new Input object to read from the terminal window or
console.
|
Input(java.lang.String fileName)
Create a new Input object that reads data from the file of the
given name.
|
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
A test method
|
boolean |
readBoolean(java.lang.String prompt)
Display the given prompt and read a boolean, i.e., the user has
to type one of yes, no, true, or false, either capitalized or
not, or any non-empty prefix thereof, e.g., y, t, fa, etc.
|
boolean |
readBooleanDialog(java.lang.String prompt)
Display the given prompt and read a boolean, using a pop-up
dialog window, i.e., the user has to type one of yes, no, true,
or false, either capitalized or not, or any non-empty prefix
thereof, e.g., y, t, fa, etc.
|
char |
readChar(java.lang.String prompt)
Display the given prompt and read a character
|
char |
readCharDialog(java.lang.String prompt)
Display the given prompt and read a character, using a
pop-up dialog window.
|
double |
readDouble(java.lang.String prompt)
Display the given prompt and read a double.
|
double |
readDoubleDialog(java.lang.String prompt)
Display the given prompt and read a double, using a
pop-up dialog window.
|
int |
readInt(java.lang.String prompt)
Display the given prompt and read an integer.
|
int |
readIntDialog(java.lang.String prompt)
Display the given prompt and read an integer, using a
pop-up dialog window.
|
java.lang.String |
readString(java.lang.String prompt)
Display the given prompt and read a single word of input.
|
java.lang.String |
readStringDialog(java.lang.String prompt)
Display the given prompt and read a single word of input, using a
pop-up dialog window.
|
public Input()
public Input(java.lang.String fileName)
fileName
- the name of the file to read frompublic java.lang.String readString(java.lang.String prompt)
prompt
- the prompt to displaypublic char readChar(java.lang.String prompt)
prompt
- the prompt to displaypublic double readDouble(java.lang.String prompt)
prompt
- the prompt to displaypublic int readInt(java.lang.String prompt)
prompt
- the prompt to displaypublic boolean readBoolean(java.lang.String prompt)
prompt
- the prompt to displaypublic java.lang.String readStringDialog(java.lang.String prompt)
prompt
- the prompt to displaypublic char readCharDialog(java.lang.String prompt)
prompt
- the prompt to displaypublic double readDoubleDialog(java.lang.String prompt)
prompt
- the prompt to displaypublic int readIntDialog(java.lang.String prompt)
prompt
- the prompt to displaypublic boolean readBooleanDialog(java.lang.String prompt)
prompt
- the prompt to displaypublic static void main(java.lang.String[] args)