public double ProcessMenu(int choice, MathOperations ops) { ops.FirstOperand = promptForInteger(); ops.SecondOperand = promptForInteger(); switch (choice) { case 0: return(ops.Addition()); case 1: return(ops.Subtraction()); case 2: return(ops.Multiplication()); case 3: return(ops.Division()); default: throw new Exception("Something went very wrong here"); } }
static void Main() { Console.WriteLine(MathOperations.Add(2, 3)); Console.WriteLine(MathOperations.Add(2.2, 3.3, 5.5)); Console.WriteLine(MathOperations.Add(2.2m, 3.3m, 4.4m)); }