/// <summary> /// Basic method Main is used to test simple features of the program including info input and basic operations. /// </summary> /// <exception cref="FormatException">If you try to enter info different from value type, it will throw an exception.</exception> static void Main(string[] args) { Calculator calc = new Calculator(); double num1, num2; char oper; while (true) { Console.WriteLine("Enter number one:"); // gets user input for the first number num1 = double.Parse(Console.ReadLine()); Console.WriteLine("Enter number two:"); // gets user input for the second number num2 = double.Parse(Console.ReadLine()); Console.WriteLine("Choose an operation (+ - / *):"); // gets user input for the operation oper = char.Parse(Console.ReadLine()); try { calc.ResultingOperation(num1, num2, oper); // throws an exception in case of dividing by zero } catch (DivideByZeroException ex) { Console.WriteLine("Exception caught: " + ex.Message); // shows an exception message } } }