You have four functions: add, subtract, multiply, and divide:
fun add(x: Int, y: Int) = x + y
fun subtract(x: Int, y: Int) = x - y
fun multiply(x: Int, y: Int) = x * y
fun divide(x: Int, y: Int) = x / y
In this task, you should create a calculator by using function references of these four functions.
As input, you are given two numbers and the name of the action you should perform on the numbers. You need to output the result.
The action names can be: add, subtract, multiply, or divide.
Guaranteed that y can't be 0 when the action is divide.