Create a security system for age appropriate access to social media. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Create a security system for age appropriate access to social media.

I need to make a program on the above topic. Please help someone. Age should be above 18 and I still have to input the code for the email which I can't seem to get. https://code.sololearn.com/cUbhQd8ExmoD/?ref=app

14th Feb 2023, 7:12 AM
Mimi Yaa
Mimi Yaa - avatar
3 Answers
+ 1
What is your attempt so that we can help you debug?
14th Feb 2023, 10:32 AM
Justice
Justice - avatar
+ 1
After Scanner class import, it works fine. In code link, for emailaddress = name.nextLine() name is not scanner object, it must be keyboard like keyboard.nextLine() ; but already have email input then you can use emailaddress= email. Else remove anyone of these two...
14th Feb 2023, 2:57 PM
Jayakrishna 🇮🇳
0
import java.util.Scanner; public class HowOldAreYou { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); String name; int age; System.out.print("Hey, what's your name? "); name = keyboard.next(); System.out.println(); System.out.print("Ok, " + name + ", how old are you? "); age = keyboard.nextInt(); System.out.println(); if (age < 16) { System.out.println("You can't Login in Facebook, " + name + "."); } if (age < 18) { System.out.println("You can't Login in Instagram, " + name + "."); } if (age < 25) { System.out.println("You can login, " + name + "."); } if (age >= 25) { System.out.println("You can do anything that's legal, " + name + "."); } } }
14th Feb 2023, 11:14 AM
Mimi Yaa
Mimi Yaa - avatar