Ejemplo n.º 1
0
        //client
        static void Main(string[] args)
        {
            // build the following expression ((((2+5)-1)*4)/3)
            Number a        = new Number(2);
            Number b        = new Number(5);
            Add    addition = new Add(a, b);

            Number c           = new Number(1);
            Sub    subtraction = new Sub(addition, c);

            Number d = new Number(4);
            Multi  multiplication = new Multi(subtraction, d);

            Number e      = new Number(3);
            Div    divide = new Div(multiplication, e);

            Console.WriteLine("\nResult of: {0} is: {1}\n", divide.Show(), divide.Calculate());
            Console.WriteLine("Result of: {0} is: {1}", multiplication.Show(), multiplication.Calculate());

            Console.ReadKey();
        }