Exemple #1
0
        static void Main(string[] args)
        {
            Employe e1 = new Employe("Godard", "stephen", 24, 2000);
            Employe e2 = new Employe("Azerty", "Querty", 30, 1800);
            Employe e3 = new Employe("Personne 3", "Nom Personne 3", 19, 1600);
            Employe e4 = new Employe("Employe 4", "Nom Employe 4", 27, 2400);

            Chef      c1 = new Chef("Chef 1", "nom Chef 1", 33, 3000, "Marketing");
            Chef      c2 = new Chef("Chef 2", "nom Chef 2", 30, 3200, "Informatique");
            Directeur d  = new Directeur("Directeur", "nom Directeur", 38, 4500, "R&D", "Compas-nie");

            e1.salaire = 7000;
            c1.service = "Informatique";

            List <Personne> personneList = new List <Personne>()
            {
                e1,
                e2,
                e3,
                e4,
                c1,
                c2,
                d
            };

            for (int i = 0; i < personneList.Count; i++)
            {
                personneList[i].afficher();
            }
            personneList[0]++;
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Employe   employe1  = new Employe("Robert", "Jorge", 34, 2400);
            Employe   employe2  = new Employe("George", "Lucas", 55, 3000);
            Employe   employe3  = new Employe("Pas di caprio", "Leonardo", 39, 2900);
            Employe   employe4  = new Employe("Earthwalker", "Luke", 27, 2600);
            Employe   employe5  = new Employe("Multiple", "Han", 45, 3700);
            Chef      chef1     = new Chef("McCain", "John", 49, 5700, "General");
            Chef      chef2     = new Chef("McDonald", "David", 49, 5700, "Informatique");
            Directeur directeur = new Directeur("Philip", "Michael", 65, 75000, "General", "CsharpCorporation");

            Personne[] societeTableau = new Personne[]
            {
                employe1,
                employe2,
                employe3,
                employe4,
                employe5,
                chef1,
                chef2,
                directeur
            };

            for (int i = 0; i < societeTableau.Length; i++)
            {
                societeTableau[i].Afficher();
            }

            Employe Emp1 = (Employe)societeTableau[3];

            Emp1.SetAge()++;
            societeTableau[2] = Emp1;

            Employe tempEmp = (Employe)societeTableau[2];

            tempEmp.Salaire   = 1200;
            societeTableau[2] = tempEmp;

            Chef tempChef = (Chef)societeTableau[5];

            tempChef.Service  = "Ressources humaines";
            societeTableau[5] = tempChef;

            foreach (Personne p in societeTableau)
            {
                p.Afficher();
            }
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Employe e1 = new Employe("Kirigaya", "Kazuto", 17, 2000);
            Employe e2 = new Employe("Yuki", "Asuna", 18, 2000);
            Employe e3 = new Employe("Synthesis Thirty", "Alice", 19, 2000);
            Employe e4 = new Employe("Knight", "Eugeo", 19, 2000);
            Employe e5 = new Employe("Kirigaya", "Suguha", 17, 2000);

            Chef c1 = new Chef("Koujiro", "Rinko", 28, 5000, "RATH");
            Chef c2 = new Chef("Kikuoka", "Kikuoka", 30, 5000, "RATH");

            Directeur d1 = new Directeur("Akihiko", "Kayaba", 30, 7000, "IA", "THE SEED");

            List <Personne> personneList = new List <Personne>()
            {
                e1,
                e2,
                e3,
                e4,
                e5,
                c1,
                c2,
                d1
            };

            for (int i = 0; i <= personneList.Count - 1; i++)
            {
                personneList[i].Afficher();
            }

            personneList[0]++;
            c1.Salaire += 500;
            c2.Service  = "DEFENSE";

            foreach (var personne in personneList)
            {
                personne.Afficher();
            }


            Console.ReadKey();
        }
Exemple #4
0
        public static void Main(string[] args)
        {
            var emp1  = new Employe("jean", "michel", 44, 1900.50);
            var emp2  = new Employe("jean", "patrick", 24, 1500);
            var emp3  = new Employe("jean", "moulin", 34, 1500);
            var emp4  = new Employe("jean", "claude", 54, 1500);
            var emp5  = new Employe("jean", "marie", 14, 1500);
            var chef1 = new Chef("marie", "christine", 44, 2300, "RH");
            var chef2 = new Chef("marie", "therese", 44, 2300, "DSI");
            var dir1  = new Directeur("anne", "lise", 44, 2300, "ELITE", "Leclerc");

            dir1.Afficher();
            chef2.Afficher();
            emp3.Afficher();

            Personne[] personnesArray = new Personne[8];
            personnesArray[0] = emp1;
            personnesArray[1] = emp2;
            personnesArray[2] = emp3;
            personnesArray[3] = emp4;
            personnesArray[4] = emp5;
            personnesArray[5] = chef1;
            personnesArray[6] = chef2;
            personnesArray[7] = dir1;

            for (int i = 0; i < personnesArray.Length; i++)
            {
                personnesArray[i].Afficher();
            }

            emp1++;
            emp2.Salaire  = 1600;
            chef1.Service = "DRH";


            for (int i = 0; i < personnesArray.Length; i++)
            {
                personnesArray[i].Afficher();
            }
        }
        static void Main(string[] args)
        {
            var employe1 = new Employe("Liane", "Beaujolie", 18, 1000);
            var employe2 = new Employe("Onfroi ", "Baron", 22, 2000);
            var employe3 = new Employe("Orlene ", "Ratté", 1500);
            var employe4 = new Employe("Felicien ", "Cinq-Mars", 26, 1250);
            var employe5 = new Employe("Madeleine ", "Leclair", 1900);

            var chef1 = new Chef("Édith", "Camus", 3000, "Informatique");
            var chef2 = new Chef("Solaine", "Laframboise", 45, 3000, "Informatique");

            var directeur = new Directeur("Somerville", "Marquis", 4000, "Direction", "Facebook");


            var tableauArticle = new[]
            { employe1, employe2, employe3, employe4, employe5, chef1, chef2, directeur };

            Console.WriteLine("[Parcours de tous les employés avec FOR]");
            for (int i = 0; i < tableauArticle.Length; i++)
            {
                tableauArticle[i].Afficher();
                Console.WriteLine(Environment.NewLine);
            }

            employe2.Age++;

            chef1.Salaire = 3500;
            chef1.Service = "Comptable";


            Console.WriteLine("[Parcours de tous les employés avec FOREACH]");
            foreach (var employe in tableauArticle)
            {
                employe.Afficher();
                Console.WriteLine(Environment.NewLine);
            }
        }