Complete a Java program that checks the eligibility of a user to access certain content by providing feedback that matches the conditions for each case.
Conditional statement
Age Eligibility Checker
Report a typo
Fill in the gaps with the relevant elements
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int requiredAge = 18;
int parentalConsentAge = 16;
int userAge = scanner.nextInt();
String feedback = ;
if (userAge < requiredAge) {
if (userAge >= parentalConsentAge) {
feedback = ;
} else {
int remainingYears = requiredAge - userAge;
feedback = ;
}
}
System.out.println(feedback);
}
}Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.