ConsoleReader class

  • 5
Today students at the secret CodeGym center received a reading assignment. They (and you) need to create a ConsoleReader class with 4 static methods: one of them reads a string from the keyboard, the second — an integer, and the third — a fractional number. The fourth is different: it reads the string "true" or "false" from the keyboard and returns the corresponding boolean value.
You can't complete this task, because you're not signed in.
  • Popular
  • New
  • Old
You must be signed in to leave a comment
ThomasLevel 9
9 December 2018, 16:19
I found this helpful for this task:
P. PukLevel 9 , Amsterdam
26 November 2018, 13:54
The assignment states to read a string(!) and return the boolean true or false. If I read a string and return true if the string is "true" or false if the string is "false" then I get the comment to read a boolean! So the assignment isn't clear...
Koushik KintaliLevel 9 , Rayagada
20 October 2018, 09:54
How can we read a boolean value from keyboard
RomanLevel 41
22 October 2018, 05:27
You can read the string "true" or "false" from the keyboard and convert it to the corresponding boolean value (true or false).
Kimberly HughesLevel 8 , San Antonio
16 September 2019, 03:32
The question is how to do that.
RomanLevel 41
31 October 2019, 07:54
Somehow like this:
String s = /*read string from console*/;
boolean b;
if ("true".equals(s)) {
  b = ...;
} ...