public static void Main(string[] args) { // starting to learn projects in c# // Author@ Anthony Amoah // simple calculator app try { var inputConverter = new InputConverter(); var calculatorEngine = new CalculatorEngine(); var firstNumber = inputConverter.ConvertInputToNumber(Console.ReadLine()); var secondNumber = inputConverter.ConvertInputToNumber(Console.ReadLine()); var operation = Console.ReadLine(); var results = calculatorEngine.calculate(operation, firstNumber, secondNumber); Console.WriteLine(results); } catch (Exception e) { // Start logging exceptions Console.WriteLine(e.Message); } }
static void Main(string[] args) { try { InputConverter inputConverter = new InputConverter(); CalculatorEngine calculatorEngine = new CalculatorEngine(); double firstNumber = inputConverter.ConvertInputToNumeric(Console.ReadLine()); double secondNumber = inputConverter.ConvertInputToNumeric(Console.ReadLine()); string operation = Console.ReadLine(); double result = calculatorEngine.Calculate(operation, firstNumber, secondNumber); Console.WriteLine(result); Console.ReadKey(); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.ReadKey(); } }