class Main {
public static void main(String[] args) {
String str = "N";
String result = switch(str) {
case "A" -> "for Apple";
case "B" -> "for Ball";
case "C" -> "for Cat";
case "D" -> "for Dog";
default -> "for another else";
};
System.out.println(str + " " + result);
int i = 10;
int j = 0;
System.out.println(calculate(i, j, "*"));
}
public static double calculate(int a, int b, String operator) {
return switch(operator) {
case "+" -> a + b;
case "-" -> a - b;
case "*" -> a * b;
case "/" -> (double) a / b;
default -> 0;
};
}
}