diff --git a/Java Classes and Interfaces/Calc Engine/src/calcEngine.java b/Java Classes and Interfaces/Calc Engine/src/calcEngine.java deleted file mode 100644 index 66b9df9..0000000 --- a/Java Classes and Interfaces/Calc Engine/src/calcEngine.java +++ /dev/null @@ -1,43 +0,0 @@ -public class calcEngine { - - public static void main(String[] args) { - performCalculations(); - } - - static void performCalculations() { - double[] leftVals = {100.0d, 25.0d, 225.0d, 11.0d}; - double[] rightVals = {50.0d, 92.0d, 17.0d, 3.0d}; - char[] opCodes = {'d', 'a', 's', 'm'}; - double[] results = new double[opCodes.length]; - - for (int i = 0; i < opCodes.length; i++) { - results[i] = execute(opCodes[i], leftVals[i], rightVals[i]); - } - for (double currentResult : results) - System.out.println("result = " + currentResult); - - } - - static double execute(char opCode, double leftVal, double rightVal) { - double result; - switch (opCode) { - case 'a': - result = leftVal + rightVal; - break; - case 's': - result = leftVal - rightVal; - break; - case 'm': - result = leftVal * rightVal; - break; - case 'd': - result = rightVal != 0 ? leftVal / rightVal : 0.0d; - break; - default: - System.out.println("Invalid opCode: " + opCode); - result = 0.0d; - break; - } - return result; - } -} \ No newline at end of file