content: import java.util.Scanner;
  
  public class QuestionNum10 {
      public static void main(String[] args) {
          Scanner scanner = new Scanner(System.in);
          
          System.out.print("Enter first number: ");
          double num1 = scanner.nextDouble(); // taking the values
          
          System.out.print("Enter second number: ");
          double num2 = scanner.nextDouble(); 
          
          System.out.print("Enter operator (+, -, *, /): ");
          char operator = scanner.next().charAt(0); //  taking the sign
          
          double result;
          // Switch statement for calculator operations
          switch (operator) {
              case '+':
                  result = num1 + num2;
                  System.out.println("Result: " + result);
                  break;
              case '-':
                  result = num1 - num2;
                  System.out.println("Result: " + result);
                  break;
              case '*':
                  result = num1 * num2;
                  System.out.println("Result: " + result);
                  break;
              case '/':
                  if (num2 != 0) {
                      result = num1 / num2;
                      System.out.println("Result: " + result);
                  } else {
                      System.out.println("Error: Division by zero");
                  }
                  break;
              default:
                  System.out.println("Invalid operator");
          }
          
          scanner.close();
      }
  }
  