Written by Danielle Kain and Kevin Miller
Console Programs allow for interaction between your program and the user. In order to write a program, make sure your program extends ConsoleProgram
:
public class Example extends ConsoleProgram {
...
}
One cool thing that Console Programs let you do is get input from the user. Below are some examples:
// Reads a String from the user into response
String response = readLine(String promptMessage);
// Reads an int from the user into number
int number = readInt(String promptMessage);
// Reads a decimal from the user into fraction
int fraction = readDouble(String promptMessage);
// Prints a message to the console
println(String printMessage);