public class ConsoleProgram
extends java.lang.Object
Constructor and Description |
---|
ConsoleProgram()
Setups a new Scanner for System.in and the inputs variable for storring
inputs.
|
Modifier and Type | Method and Description |
---|---|
void |
addInput(java.lang.String s)
Allows you to add an input to your inputs.
|
static void |
main(java.lang.String[] args)
ConsoleProgram can also be run as the main class.
|
void |
print()
Allows us to use a shorthand version for System.out.print()
|
void |
print(boolean x)
Allows us to use a shorthand version for System.out.print(boolean x)
|
void |
print(char x)
Allows us to use a shorthand version for System.out.print(char x)
|
void |
print(char[] x)
Allows us to use a shorthand version for System.out.print(char[] x)
|
void |
print(double x)
Allows us to use a shorthand version for System.out.print(double x)
|
void |
print(float x)
Allows us to use a shorthand version for System.out.print(float x)
|
void |
print(int x)
Allows us to use a shorthand version for System.out.print(int x)
|
void |
print(long x)
Allows us to use a shorthand version for System.out.print(long x)
|
void |
print(java.lang.Object o)
Allows us to use a shorthand version for System.out.print(Object o)
|
void |
print(java.lang.String s)
Allows us to use a shorthand version for System.out.print(String s)
|
void |
println()
Allows us to use a shorthand version for System.out.println()
|
void |
println(boolean x)
Allows us to use a shorthand version for System.out.println(boolean x)
|
void |
println(char x)
Allows us to use a shorthand version for System.out.println(char x)
|
void |
println(char[] x)
Allows us to use a shorthand version for System.out.println(char[] x)
|
void |
println(double x)
Allows us to use a shorthand version for System.out.println(double x)
|
void |
println(float x)
Allows us to use a shorthand version for System.out.println(float x)
|
void |
println(int x)
Allows us to use a shorthand version for System.out.println(int x)
|
void |
println(long x)
Allows us to use a shorthand version for System.out.println(long x)
|
void |
println(java.lang.Object o)
Allows us to use a shorthand version for System.out.println(Object o)
|
void |
println(java.lang.String s)
Allows us to use a shorthand version for System.out.println(String s)
|
boolean |
readBoolean(java.lang.String prompt)
Allow the user to get a boolean.
|
double |
readDouble(java.lang.String prompt)
Allow the user to get a double.
|
int |
readInt(java.lang.String prompt)
Allow the user to get an integer.
|
java.lang.String |
readLine(java.lang.String prompt)
This is a dual purpose function.
|
void |
run()
This is a run method for the class.
|
void |
setInputs(java.lang.String[] inputStrings)
Allows you to set all inputs at once as strings.
|
public ConsoleProgram()
public void run()
public void setInputs(java.lang.String[] inputStrings)
inputStrings
- Array of strings to be inputspublic void addInput(java.lang.String s)
s
- String to addpublic static void main(java.lang.String[] args)
args
- class name to run should be the first argumentpublic java.lang.String readLine(java.lang.String prompt)
prompt
- String prompt to show userpublic boolean readBoolean(java.lang.String prompt)
prompt
- String prompt to show userpublic double readDouble(java.lang.String prompt)
prompt
- String prompt to show userpublic int readInt(java.lang.String prompt)
prompt
- String prompt to show userpublic void println()
public void println(java.lang.String s)
s
- String to printpublic void println(boolean x)
x
- Boolean to printpublic void println(char x)
x
- Character to printpublic void println(char[] x)
x
- Character arry to printpublic void println(int x)
x
- Integer to printpublic void println(long x)
x
- Long to printpublic void println(float x)
x
- Float to printpublic void println(double x)
x
- Double to printpublic void println(java.lang.Object o)
o
- Object to printpublic void print()
public void print(java.lang.String s)
s
- String to print with a new linepublic void print(boolean x)
x
- Boolean to print with a new linepublic void print(char x)
x
- Character to print with a new linepublic void print(char[] x)
x
- Character arry to print with a new linepublic void print(int x)
x
- Integer to print with a new linepublic void print(long x)
x
- Long to print with a new linepublic void print(float x)
x
- Float to print with a new linepublic void print(double x)
x
- Double to print with a new linepublic void print(java.lang.Object o)
o
- Object to print with a new line