diff --git a/Program.cs b/Program.cs index 9a3d197..f41270e 100644 --- a/Program.cs +++ b/Program.cs @@ -2,4 +2,4 @@ //using Programmation_objet_TLESIO21.TD2; using Programmation_objet_TLESIO21.TD3; -Td3.Launch(); +TD4.Launch(); diff --git a/TD3/TD3.cs b/TD3/TD3.cs index 4514d5b..07795dc 100644 --- a/TD3/TD3.cs +++ b/TD3/TD3.cs @@ -7,7 +7,7 @@ using Programmation_objet_TLESIO21.TD3.fleuriste; namespace Programmation_objet_TLESIO21.TD3 { - public static class Td3 { + public static class TD4 { public static void Exo1_1() { Compte c1 = new Compte(); diff --git a/TD4/Collaborateur.cs b/TD4/Collaborateur.cs new file mode 100644 index 0000000..d4420bd --- /dev/null +++ b/TD4/Collaborateur.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Programmation_objet_TLESIO21.TD4 { + public class Collaborateur { + private readonly String NOM; + private String DateNaissance; + + public Collaborateur(String nom, String birthdate) { + this.NOM = nom; + this.DateNaissance = birthdate; + } + + public virtual double getSalaire() { + return .0; + } + } +} diff --git a/TD4/Commercial.cs b/TD4/Commercial.cs new file mode 100644 index 0000000..0859a65 --- /dev/null +++ b/TD4/Commercial.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Programmation_objet_TLESIO21.TD4 { + public class Commercial : Collaborateur { + private int SalaireBase; + private int ChiffreAffaire; + private readonly double T2 = 1.1; + + public Commercial(String nom, String birthdate, int salaireBase, int chiffreAffaire) : base(nom, birthdate) { + this.SalaireBase = salaireBase; + this.ChiffreAffaire = chiffreAffaire; + } + + public override double getSalaire() { + return this.SalaireBase + this.ChiffreAffaire * T2; + } + + + } +} diff --git a/TD4/Employe.cs b/TD4/Employe.cs new file mode 100644 index 0000000..684e47c --- /dev/null +++ b/TD4/Employe.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Programmation_objet_TLESIO21.TD4 { + public class Employe : Collaborateur { + private int TauxHoraire; + private int NbHeures; + private readonly double T1 = 1.1; + + public Employe(String nom, String birthdate, int tauxHoraire, int nbHeures) : base(nom, birthdate) { + this.TauxHoraire = tauxHoraire; + this.NbHeures = nbHeures; + } + + public override double getSalaire() { + double salaire = 0; + + if(this.NbHeures > 35) { + salaire += (this.NbHeures - 35) * this.TauxHoraire * T1; + } + + salaire += this.NbHeures * this.TauxHoraire; + + return salaire; + } + + + } +} diff --git a/TD4/Manager.cs b/TD4/Manager.cs new file mode 100644 index 0000000..3fcc776 --- /dev/null +++ b/TD4/Manager.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Programmation_objet_TLESIO21.TD4 { + public class Manager : Collaborateur { + private int SalaireBase; + private int Prime; + + public Manager(String nom, String birthdate, int salaireBase, int prime) : base(nom, birthdate) { + this.SalaireBase = salaireBase; + this.Prime = prime; + } + + public override double getSalaire() { + return this.SalaireBase + this.Prime; + } + + + + + } +} diff --git a/TD4/TD4.cs b/TD4/TD4.cs new file mode 100644 index 0000000..b92efbc --- /dev/null +++ b/TD4/TD4.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Programmation_objet_TLESIO21.TD3.fleuriste; + + +namespace Programmation_objet_TLESIO21.TD4 { + public static class TD4 { + public static void Exo1() { + TabCollaborateur tab = new TabCollaborateur(); + Employe e1 = new Employe("Lejaune", "13051956", 20, 30); + Employe e2 = new Employe("LeBlanc", "20051970", 15, 100); + Manager m1 = new Manager("LeRouge", "14011998", 2500, 150); + Manager m2 = new Manager("LeVert", "29101987", 3000, 200); + Commercial c1 = new Commercial("LeNoir", "29011987", 4000, 30000); + Commercial c2 = new Commercial("LeViolet", "29011987", 3000, 30000); + tab.Add(c1); + tab.Add(e1); + tab.Add(m1); + tab.Add(e2); + tab.Add(m2); + tab.Add(c2); + Console.WriteLine("COLLABORATEUR AYANT PLUS HAUT SALAIRE"); + Console.WriteLine(tab.PlusHautSal()); + Console.WriteLine("EMPLOYE AYANT PLUS HAUT SALAIRE"); + Console.WriteLine(tab.PlusHautSal("Employe")); + Console.WriteLine("MANAGER AYANT PLUS HAUT SALAIRE"); + Console.WriteLine(tab.PlusHautSal("Manager")); + Console.WriteLine("COMMERCIAL AYANT PLUS HAUT SALAIRE"); + Console.WriteLine(tab.PlusHautSal("Commercial")); + Console.WriteLine("TRI SUR AGE "); + tab.Sort(); + foreach(Collaborateur c in tab) + Console.WriteLine(c); + Console.WriteLine("TRI SUR SALAIRE "); + tab.Sort(new TriSalaire()); + foreach(Collaborateur c in tab) + Console.WriteLine(c) + } + + public static void Launch() { + + } + + + } +} \ No newline at end of file diff --git a/pdf/CM/Cours4C#.pdf b/pdf/CM/Cours4C#.pdf new file mode 100644 index 0000000..6c19bb2 Binary files /dev/null and b/pdf/CM/Cours4C#.pdf differ diff --git a/pdf/TD/TD4.pdf b/pdf/TD/TD4.pdf new file mode 100644 index 0000000..e87a145 Binary files /dev/null and b/pdf/TD/TD4.pdf differ