Suppose you are the president of Joy Land. Everything was great until a mysterious disease broke out in your country. As a leader, you asked your scientist to synthesize vaccines to fight the disease. Your capable scientist was able to develop a vaccine but they warned you not to use it on a certain age group as shown by the notAllowedAgeGroup set. Now you have to address the nation and tell the citizens about the latest development. In the news headlines, you want the age group eligible for vaccination to flash. For that you need to have an EnumSet that contains code for allowed age groups. Your task is to create such a set and print it.
Enumset
Vaccination
Report a typo
Sample Input 1:
Sample Output 1:
[AGE_18_TO_45, AGE_46_TO_60, AGE_60_ABOVE]Write a program in Java 17
import java.util.EnumSet;
public class Main {
public enum Age {
AGE_0_TO_10, AGE_11_TO_17, AGE_18_TO_45, AGE_46_TO_60, AGE_60_ABOVE
}
public static void main(String[] args) {
EnumSet<Age> notAllowedAgeGroup = EnumSet.of(Age.AGE_0_TO_10, Age.AGE_11_TO_17);
// create an allowedAgeGroup enumSet and print it using standard printing functions
}
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
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.