Would any child close a website after being informed that it is not intended for anybody under 18? Despite being entirely ineffective, this age "verification" process is still used. Let's write a program that asks the user's age. If the answer is <18, the program displays "Grow up a little more".
18+
- 2
Locked
Comments (5)
- Popular
- New
- Old
You must be signed in to leave a comment
ZhaXi
19 December 2022, 01:02
BufferedReader bis = new BufferedReader(new InputStreamReader(System.in));
String name = bis.readLine(); // why need this?
int age = Integer.parseInt(bis.readLine());//why not this : int age = Integer.parseInt(reader.readLine());
if (age < 18) {
System.out.println("Grow up a little more");
0
Joe M
28 September 2020, 12:39
OK got it after 22 attempts on one of the easiest tasks...I think after a couple of tries you should be sure to hit "reset"..then enter fresh code....still happy I am learning about templates and Buffered Reader
0
Lex Medeiros
20 March 2019, 23:42
Could someone tell me what I am doing wrong? Below is the code and here is the error I get:

0
Roman
21 March 2019, 07:23
If you need help, something isn't right in your code, the server won't accept your solution (even if you are 100% sure that it is correct). Describe your question/issue in the HELP section at codegym.cc/help.
0
Syed Huzaifa
4 May 2020, 11:30
Bro! Try not to print any other lines ("please enter your name" or "please enter your age")
because the last 2 conditions are clearing that u don't have to print anything else (except "Grow up a little more", if the condition of age less then 18 is match)
+3