Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Enter Any Number:");
                int value = Convert.ToInt32(Console.ReadLine());

                Marvellous.Accept(value);
            }
            catch (InvalidNumberException e)
            {
                Console.WriteLine(e);
            }

            Console.WriteLine("Termination of Application..");
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Enter size:");
            int value = Convert.ToInt16(Console.ReadLine());

            Marvellous mobj = new Marvellous(value);

            mobj.Accept();

            Thread t1 = new Thread(new ThreadStart(mobj.EvenDisplay));

            Thread t2 = new Thread(new ThreadStart(mobj.OddDisplay));

            t1.Start();

            t2.Start();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Marvellous mobj = new Marvellous();

            Del <int> DelAdd = new Del <int>(mobj.AddI);

            Console.WriteLine("Integer Addition is:{0}\n", DelAdd(10, 20));

            Del <float> DelFloat = new Del <float>(mobj.AddF);

            Console.WriteLine("Float Addition is:{0}\n", DelFloat(10.0f, 20.0f));

            Del <double> DelDouble = new Del <double>(mobj.AddD);

            Console.WriteLine("Double Addition is:{0}\n", DelDouble(10.0, 20.0));


            Del <string> DelString = new Del <string>(mobj.AddS);

            Console.WriteLine("String Addition is:{0}\n", DelString("Hello", "World"));
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Enter Birth Date:");
                DateTime birthdate = DateTime.Parse(Console.ReadLine());

                if (DateTime.Today.Year < birthdate.Year)
                {
                    throw new InvalidAgeException("Invalid Age");
                }
                else
                {
                    //Console.WriteLine("Age is Valid..");

                    Marvellous mobj = new Marvellous();
                    mobj.Display(birthdate);
                }
            }
            catch (InvalidAgeException e)
            {
                Console.WriteLine(e);
            }
        }