예제 #1
0
        private void ClassExample()
        {
            Console.WriteLine("-- Classs --");
            Country earth = new Country("Earth");

            earth.Display();             //Welcome  to Earth
            earth.GetData(23);           //Country: 23
            earth.GetData(23.56);        //Country: 23.56
            ///earth.GetData(23.5m); //Compile time error- can not convert decimal to int

            Country india = new India();

            india.Display();             //Country: Welcome to India
            india.GetData(23);           //Country: 23
            india.GetData(23.56);        //Country: 23.56
            ///india.GetData(23.5m); //Compile time error- can not convert decimal to int

            Country contryMaha = new Maharashtra();

            contryMaha.Display();             //Country: Welcome to Maharashtra
            contryMaha.GetData(23);           //Country: 23
            contryMaha.GetData(23.56);        //Country: 23.56
            ///contryMaha.GetData(23.5m); //Compile time error- can not convert decimal to int

            India indiaIndia = new India();

            indiaIndia.Display();             //With out Method hiding > India: Welcome to India
            indiaIndia.GetData(23);           //India: 23
            indiaIndia.GetData(23.56);        //Country: 23.56
            //indiaIndia.GetData(23.5m); //Compile time error- can not convert decimal to int

            India indiaMaha = new Maharashtra();

            indiaMaha.Display();             //India: Welcome to Maharashtra
            indiaMaha.GetData(23);           //India: 23
            indiaMaha.GetData(23.56);        //Country: 23.56
            ///indiaMaha.GetData(23.5m); //Compile time error- can not convert decimal to int

            Maharashtra mahaMaha = new Maharashtra();

            mahaMaha.Display();             //Method hiding > Maharashtra: Welcome to Maharashtrasss
            mahaMaha.GetData(23);           //Maharashtra: 23
            mahaMaha.GetData(23.56);        //India: 23.56
            mahaMaha.GetData(23.5m);        //Maharashtra: 23.5

            Console.WriteLine("-------------------------------------");

            Country usa = new USA();

            usa.Display();
            ///usa.GunShot(); method not found
            USA usaUsa = new USA();

            usaUsa.Display();
            usaUsa.GunShot();
            //USA usCountry = new Country("This is America"); Can not implicitly convert
        }
예제 #2
0
        private static void Main(string[] args)
        {
            India ind = new India();

            ind.GetStates();

            #region Array Example

            // Arrays (Fixed length and fixed datatype), List (Dynamically shrink or resize and fixed datatype), ArrayList (Dynamically shrink or resize and is of not fixed datatype)

            string[]      states        = { "AP", "TS", "UP", "MP" };
            List <string> statesListOne = new List <string>();
            List <string> statesListTwo = new List <string>();

            // For Loop
            Console.WriteLine("For Loop Example : ");
            for (int statesIndex = 0; statesIndex < states.Length; statesIndex++)
            {
                statesListOne.Add(states[statesIndex]);
            }
            for (int statesListOneIndex = 0; statesListOneIndex < statesListOne.Count; statesListOneIndex++)
            {
                Console.WriteLine(statesListOne[statesListOneIndex]);
            }

            // For Each
            Console.WriteLine("ForEach Loop Example : ");
            foreach (string state in states)
            {
                statesListTwo.Add(state);
            }
            foreach (string s in statesListTwo)
            {
                Console.WriteLine(s);
            }

            //Parallel ForEach
            Console.WriteLine("Parallel ForEach Example : ");
            Parallel.ForEach(statesListTwo, (state) =>
            {
                Console.WriteLine(state);
            });

            #endregion Array Example
        }
예제 #3
0
    public static void Main(string[] args)
    {
        while (true)
        {
            Console.WriteLine("1.India");
            Console.WriteLine("2.USA");
            Console.WriteLine("3.UK");
            Console.WriteLine("4.UAE");
            Console.WriteLine("5.Exit");
            Console.WriteLine("Enter your choice");
            int ch = int.Parse(Console.ReadLine());
            switch (ch)
            {
            case 1:
            {
                Console.WriteLine("1. India to USA");
                Console.WriteLine("2. India to UK");
                Console.WriteLine("3. India to UAE");
                Console.Write("Enter Your Choice : ");
                int    choice = int.Parse(Console.ReadLine());
                India  indobj;
                USA    usaobj;
                UK     ukobj;
                UAE    uaeobj;
                double currency1;
                switch (choice)
                {
                case 1:
                    Console.Write("\nEnter Currency of India : ");
                    currency1 = double.Parse(Console.ReadLine());
                    indobj    = new India(currency1);
                    usaobj    = indobj;
                    Console.WriteLine("India -> USA = " + indobj.currency + " -> " + usaobj.currency);
                    break;

                case 2:
                    Console.Write("\nEnter Currency of India : ");
                    currency1 = double.Parse(Console.ReadLine());
                    indobj    = new India(currency1);
                    ukobj     = indobj;

                    Console.WriteLine("India -> UK = " + indobj.currency + " -> " + ukobj.currency);
                    break;

                case 3:
                    Console.Write("\nEnter Currency of India : ");
                    currency1 = double.Parse(Console.ReadLine());
                    indobj    = new India(currency1);
                    uaeobj    = indobj;

                    Console.WriteLine("India -> UAE" + indobj.currency + " -> " + uaeobj.currency);
                    break;

                case 4:
                    Console.Write("\nWrong Choice!!!");
                    break;
                }
            } break;

            case 2:
            {
                Console.WriteLine("1. USA to India");
                Console.WriteLine("2. USA to UK");
                Console.WriteLine("3. USA to UAE");
                Console.Write("Enter Your Choice : ");
                int    choice = int.Parse(Console.ReadLine());
                India  indobj;
                USA    usaobj;
                UK     ukobj;
                UAE    uaeobj;
                double currency1;
                switch (choice)
                {
                case 1:
                    Console.Write("\nEnter Currency of USA : ");
                    currency1 = double.Parse(Console.ReadLine());
                    usaobj    = new USA(currency1);
                    indobj    = (India)usaobj;
                    Console.WriteLine("USA -> India" + usaobj.currency + " -> " + indobj.currency);
                    break;

                case 2:
                    Console.Write("\nEnter Currency of USA : ");
                    currency1 = double.Parse(Console.ReadLine());
                    usaobj    = new USA(currency1);
                    ukobj     = usaobj;
                    Console.WriteLine("USA -> UK" + usaobj.currency + " -> " + ukobj.currency);
                    break;

                case 3:
                    Console.Write("\nEnter Currency of USA : ");
                    currency1 = double.Parse(Console.ReadLine());
                    usaobj    = new USA(currency1);
                    uaeobj    = (UAE)usaobj;
                    Console.WriteLine("USA -> UAE" + usaobj.currency + " -> " + uaeobj.currency);
                    break;

                case 4:
                    Console.Write("\nWrong Choice!!!");
                    break;
                }
            } break;

            case 3:
            {
                Console.WriteLine("1. UK to India");
                Console.WriteLine("2. UK to USA");
                Console.WriteLine("3. UK to UAE");
                Console.Write("Enter Your Choice : ");
                int    choice = int.Parse(Console.ReadLine());
                India  indobj;
                USA    usaobj;
                UK     ukobj;
                UAE    uaeobj;
                double currency1;
                switch (choice)
                {
                case 1:
                    Console.Write("\nEnter Currency of UK : ");
                    currency1 = double.Parse(Console.ReadLine());
                    ukobj     = new UK(currency1);
                    indobj    = (India)ukobj;
                    Console.WriteLine("UK -> India" + ukobj.currency + " -> " + indobj.currency);
                    break;

                case 2:
                    Console.Write("\nEnter Currency of UK : ");
                    currency1 = double.Parse(Console.ReadLine());
                    ukobj     = new UK(currency1);
                    usaobj    = (USA)ukobj;
                    Console.WriteLine("UK -> US" + ukobj.currency + " -> " + usaobj.currency);
                    break;

                case 3:
                    Console.Write("\nEnter Currency of UK : ");
                    currency1 = double.Parse(Console.ReadLine());
                    ukobj     = new UK(currency1);
                    uaeobj    = (UAE)ukobj;
                    Console.WriteLine("UK -> UAE" + ukobj.currency + "-> " + uaeobj.currency);
                    break;

                case 4:
                    Console.Write("\nWrong Choice!!!");
                    break;
                }
            } break;

            case 4:
            {
                Console.WriteLine("1. UAE to india");
                Console.WriteLine("2. UAE to USA");
                Console.WriteLine("3. UAE to UK");
                Console.Write("Enter Your Choice : ");
                int    choice = int.Parse(Console.ReadLine());
                India  indobj;
                USA    usaobj;
                UK     ukobj;
                UAE    uaeobj;
                double currency1;
                switch (choice)
                {
                case 1:
                    Console.Write("\nEnter Currency of UAE : ");
                    currency1 = double.Parse(Console.ReadLine());
                    uaeobj    = new UAE(currency1);
                    indobj    = (India)uaeobj;
                    Console.WriteLine("UAE -> India" + uaeobj.currency + " ->" + indobj.currency + " Indian Rupee");
                    break;



                case 2:
                    Console.Write("\nEnter Currency of UAE : ");
                    currency1 = double.Parse(Console.ReadLine());
                    uaeobj    = new UAE(currency1);
                    usaobj    = uaeobj;
                    Console.WriteLine("UAE -> US" + uaeobj.currency + " -> " + usaobj.currency + " US Dollar");
                    break;


                case 3:
                    Console.Write("\nEnter Currency of UAE : ");
                    currency1 = double.Parse(Console.ReadLine());
                    uaeobj    = new UAE(currency1);
                    ukobj     = uaeobj;
                    Console.WriteLine("UAE -> UK" + uaeobj.currency + " -> " + ukobj.currency + " British Pound");
                    break;


                case 4:
                    Console.Write("\nWrong Choice!!!");
                    break;
                }
            } break;

            case 5:
            {
                Environment.Exit(0);
            } break;
            }
        }
    }
예제 #4
0
    public static void Main()
    {
        Console.BackgroundColor = ConsoleColor.White;
        Console.ForegroundColor = ConsoleColor.Black;
        Console.Title           = "Born 2 Code";
        Console.Clear();
        Console.BufferWidth   = 200;
        Console.BufferHeight += 200;
        Console.WindowWidth   = 100;
        Console.WindowHeight  = 50;
        India ind = new India();

        Console.WriteLine("This program retrieves the marks of IV/IV 2nd Sem IT students of Gayatri College Of Engg.........\n");

        while (true)
        {
            Console.Write("\n1.All student marks\n2.Individual marks\n3.Plot the Graph \n4.Summary\n5.Write all student marks to a file\n6.Exit\nEnter your choice : ");
            int choice = Console.ReadLine()[0] - '0';

            switch (choice)
            {
            case 1:
                ind.AllStudents();
                allDataFetched = true;
                break;

            case 2:
                Console.Write("\nEnter the roll number (ex: 04131a1256): ");
                ind.IndividualStudent(Console.ReadLine().ToLower());
                break;

            case 3:
                if (!allDataFetched)
                {
                    Console.WriteLine("\nAll Students data hasn't fetched yet...Please select 1st option and then try 3rd option");
                }
                else
                {
                    ind.Graph();
                }
                break;

            case 4:
                if (!allDataFetched)
                {
                    Console.WriteLine("\nAll Students data hasn't fetched yet...Please select 1st option and then try 3rd option");
                }
                else
                {
                    ind.Summary();
                }
                break;

            case 5:
                StreamWriter sw = new StreamWriter("Class Marks 4-2.txt");
                Console.SetOut(sw);
                ind.AllStudents();
                Console.WriteLine("\n\nProgram Written by - K.Vineel Kumar Reddy. In C# \n");
                sw.Close();
                Environment.Exit(0);
                break;

            case 6:
                goto end;

            default:
                Console.WriteLine("\nEntered option is Wrong ...Be Cool Bose...!");
                break;
            }
        }
end:
        Console.WriteLine("\n\nProgram Written by - K.Vineel Kumar Reddy. In C# \n");
        Console.Read();
    }
예제 #5
0
파일: India.cs 프로젝트: minikie/test
 public India(India.Market m) : this(NQuantLibcPINVOKE.new_India__SWIG_0((int)m), true) {
   if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #6
0
파일: India.cs 프로젝트: minikie/test
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(India obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
예제 #7
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(India obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
예제 #8
0
        private void reset()// reseta todos os pontos para proxima fase
        {
            saoPaulo      = new SaoPaulo();
            bahia         = new Bahia();
            caribe        = new Caribe();
            usa_leste     = new USA_Leste();
            usa_oeste     = new USA_Oeste();
            japao         = new Japao();
            china         = new China();
            tailandia     = new Tailandia();
            australia     = new Australia();
            unitedKingdom = new UnitedKingdom();
            africaCentral = new AfricaCentral();
            africaSul     = new AfricaSul();
            india         = new India();

            saoPaulo.getCondicao(true);
            bahia.getCondicao(true);
            caribe.getCondicao(true);
            usa_leste.getCondicao(true);
            usa_oeste.getCondicao(true);
            japao.getCondicao(true);
            china.getCondicao(true);
            tailandia.getCondicao(true);
            australia.getCondicao(true);
            unitedKingdom.getCondicao(true);
            africaCentral.getCondicao(true);
            africaSul.getCondicao(true);
            india.getCondicao(true);
            europaLeste.getCondicao(true);
            europaOeste.getCondicao(true);

            saoPaulo.getBloquedo(false);
            bahia.getBloquedo(false);
            caribe.getBloquedo(false);
            usa_leste.getBloquedo(false);
            usa_oeste.getBloquedo(false);
            japao.getBloquedo(false);
            china.getBloquedo(false);
            tailandia.getBloquedo(false);
            australia.getBloquedo(false);
            unitedKingdom.getBloquedo(false);
            africaCentral.getBloquedo(false);
            africaSul.getBloquedo(false);
            india.getBloquedo(false);
            europaLeste.getBloquedo(false);
            europaOeste.getBloquedo(false);

            saoPaulo.get_pct(pctSaoPaulo);
            bahia.get_pct(pctBahia);
            caribe.get_pct(pctCaribe);
            usa_leste.get_pct(pct_USA_Leste);
            usa_oeste.get_pct(pct_USA_Oeste);
            japao.get_pct(pctJapao);
            china.get_pct(pctChina);
            tailandia.get_pct(pctTailandia);
            australia.get_pct(pctAustralia);
            unitedKingdom.get_pct(pct_UnitedKingdom);
            africaCentral.get_pct(pctAfricaCenter);
            africaSul.get_pct(pctAfricaSul);
            india.get_pct(pctIndia);
            europaLeste.get_pct(pctEuropaLeste);
            europaOeste.get_pct(pctEuropaOeste);

            saoPaulo.mudarPonto();
            bahia.mudarPonto();
            caribe.mudarPonto();
            usa_leste.mudarPonto();
            usa_oeste.mudarPonto();
            japao.mudarPonto();
            china.mudarPonto();
            tailandia.mudarPonto();
            australia.mudarPonto();
            unitedKingdom.mudarPonto();
            africaCentral.mudarPonto();
            africaSul.mudarPonto();
            india.mudarPonto();
            europaOeste.mudarPonto();
            europaLeste.mudarPonto();
        }