Set of vowels

Report a typo

Change the code, paying special attention to switch statement cases, by modifying the EnumSet enumSet variable by interpreting the case string. You do not have to write any I/O statements.

Note: the letters in the enum Alphabets are arranged alphabetically. The elements of the enumSet in each case must also be in alphabetical order.

Tip: No need to import classes — you just have to store the results in the enumSet variable.

Sample Input 1:

setOfVowels

Sample Output 1:

[A, E, I, O, U]
Write a program in Java 17
import java.util.EnumSet;
import java.util.Scanner;

public class Main {

// don't change the enum
enum Alphabets {
A, B, E, I, L, O, T, U
}

EnumSet<Alphabets> enumSet;

public static void main(String[] args) {
Main object = new Main();

Scanner sc = new Scanner(System.in);
String string = sc.nextLine().trim();

// Change the code below this line
switch (string) {
case "setOfVowels":
break;
case "setOfConsonants":
break;
case "containsAOnly":
break;
case "empty":
break;
case "exceptT-A-E":
break;
default : System.out.println("ERROR");
break;
}
System.out.println(object.enumSet);
// Change the code above this line
}
___

Create a free account to access the full topic