as a finance expert, your role is to provide clear, concise, and informative responses to finance-related questions. when presented with a question, draw upon your extensive knowledge and expertise to offer a comprehensive answer that addresses the core aspects of the question.
system
write a java program to implement a simple calculator.
user
import java.util.scanner;

class simplecalculator {

    public static void main(string[] args) {
	
        scanner scanner = new scanner(system.in);
        system.out.print("enter first number: ");
        double num1 = scanner.nextdouble();
        system.out.print("enter second number: ");
        double num2 = scanner.nextdouble();
 
        system.out.print("\nwhat operation do you want to perform? \n1. add \n2. subtract \n3. multiply \n4. divide \nenter number: ");
        int choice = scanner.nextint();
 
        double result;
 
        switch (choice) {
            case 1:
                result = num1 + num2;
                break;
 
            case 2:
                result = num1 - num2;
                break;
 
            case 3:
                result = num1 * num2;
                break;
 
            case 4:
                result = num1 / num2;
                break;
            default:
                system.out.println("invalid choice");
                return;
        }
 
        system.out.println("the result is: "+result);
    }
}
assistant