Exemplo n.º 1
0
        private static void LibraryFunction(int firstNumber, int secondNumber)
        {
            Calculator calc = new Calculator();

            Console.WriteLine("Addition = " + calc.Addition(firstNumber, secondNumber));
            Console.WriteLine("Subtraction = " + calc.Subtraction(firstNumber, secondNumber));
            Console.WriteLine("Multiplication = " + calc.Multiplication(firstNumber, secondNumber));
            Console.WriteLine("Division = " + calc.Division(firstNumber, secondNumber));
        }
        static void Main(string[] args)
        {
            Calculator calculator = new Calculator();

            Console.Write("   Enter first operand:       ");
            calculator.FirstOperand = Convert.ToDouble(Console.ReadLine());  //get the first
            Console.Write("   Enter first operand:       ");
            calculator.SecondOperand = Convert.ToDouble(Console.ReadLine()); //get the second
            calculator.Addition();                                           //Do addition
            Console.WriteLine("Addition Result: {0}", calculator.Result);    //show result
            Console.WriteLine("Press any key to continue.....");
            Console.ReadLine();
        }