import java.util.Scanner;

public class Calculator {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the first number: ");
        double num1 = scanner.nextDouble();
        System.out.println(num1);

        System.out.print("Enter the second number: ");
        double num2 = scanner.nextDouble();
        System.out.println(num2);

        System.out.println("Choose an operation: ");
        System.out.println("1. Add");
        System.out.println("2. Subtract");
        System.out.println("3. Multiply");
        System.out.println("4. Divide");

        int operation = scanner.nextInt();
        double result = 0;

        switch (operation) {
            case 1:
                System.out.println("+");
                result = num1 + num2;
                break;
            case 2:
                System.out.println("-");
                result = num1 - num2;
                break;
            case 3:
                System.out.println("*");
                result = num1 * num2;
                break;
            case 4:
                System.out.println("/");
                if (num2 != 0) {
                    result = num1 / num2;
                } else {
                    System.out.println("Cannot divide by zero.");
                    return;
                }
                break;
            default:
                System.out.println("Invalid operation.");
                return;
        }

        System.out.println("Result: " + result);

        scanner.close();
    }
}

Calculator.main(new String[0]);


Enter the first number: 4.0
Enter the second number: 6.0
Choose an operation: 
1. Add
2. Subtract
3. Multiply
4. Divide
*
Result: 24.0