- Read a line of text from the console
Example:
String colour = readLine("Enter your favourite colour? ");
- Read an integer from the console
Example:
int numGarage = readInt("Enter the number of garages: ");
- Read a double value from the console
Example:
double avg = readDouble("Enter your grade average: ");
- Read as boolean value from the console
Example:
boolean pancakes = readBoolean("Do you like pancakes(true/false)");
<dataType> <variableName> = <readCommand>("<prompt>");
Create a program UserInput.java that asks for the following information and then outputs the information back to the console
- name
- age
- current mark
- has been assigned a locker
Enter your name: John
Enter your age: 16
Enter your current mark: 92.3
Have you been assigned a locker (true/false): true
Name: John
Age: 16
Current Mark: 92.3
Locker Assigned: true
Modify UserInput.java so that it prompts for a first name and last name