the task is to optimize the two functions
the first of them needs to pass the operation number (integer) and two operands (real numbers) and then with the help of the select operator with operands the corresponding action was performed
if (OperationNumber! = 0) { switch (OperationNumber) { case 1: OperationPlus (); break; case 2: OperationMinus (); break; case 3: OperationMultiplication (); break; case 4: OperationDivision (); break; case 5: OperationDiv (); break; case 6: OperationMod (); break; }
The essence of optimization is to replace the select statement with an array whose elements are mathematical operations, that is, instead of choosing a number, the algorithm provides for simply calling the array element with the transferred number.
the second function is almost the same, only one number is transferred to it, to calculate a certain function (such as Sin, Cos, Tg).
If in Java it is possible to organize the above-described optimization, then please tell me how to create such an array, and how to call operations / functions from it.
If anyone has free time, I would be very grateful for the help, as I just started learning Java.