Page 232 - IT2
P. 232

{ String Catégorie ;
                 public DeveloppeurInterne(Integer _Matricule,String _Nom, String _Email,String _Catégorie)
                 {
                      Super(_Matricule, _Nom,   _Email, _Taux ) ;
                     Catégorie=_Catégorie ;
                      if (Catégorie==”S”) Taux=200 ;
                      else Taux=150;
                  }
                 public float Catégorie()
                   {  return Catégorie ;}
                 public void  Catégorie(String  _Catégorie)
                   {  Catégorie =_Catégorie ; }

               // Redéfinition d’une méthode héritée

               float Calcul_Salaire(int Hs)
                   {   float Salaire;
                      if (Catégorie==”S”) Salaire=8000 ;
                      else Salaire=5000;
                      Salaire+=Salaire+super.Calcul_Salaire(Hs) ;
                      return salaire ;
                  }
               }

               Class projet
               {   Private Int Id ;
                  Private String Intitule ;
                  Private Hashtable liste ;
                  projet(int _Id ,String _Intitule)
                  {  Id=_Id ;
                     Intitule=_Intitule ;
                    Liste=new Hashtable() ;
                  }
                  void AjoutParticipant(DeveloppeurExterne D)
                  {     liste.put(D.Matricule() ,D) ;
                  }
                  float CalSalaireTousParticipant()
                 {  float salaire ;
                      Enumeration e = liste.elements();
                      while  ( e.hasMoreElements())
                      {      salaire  += salaire  + ((DeveloppeurExterne)e.nextElement()).Calcul_Salaire();
                       }
                       return  salaire ;
                   }
               }

               Program principal :
               DeveloppeurExterne  D1=new DeveloppeurExterne(1000 "’ALAMI" , "Alami@yahoo.fr ", 250 ) ;
               DeveloppeurExterne  D2=new DeveloppeurExterne(1000 "’SEFRIOUI" , "Sef@caramail.fr ", 320 ) ;
               DeveloppeurExterne  D3=new DeveloppeurInterne(1000 "BELLAM" , "bel@hotmail.fr ", "J") ;

               Projet P1=new Projet(123, "Projet123 ") ;
                                           www.itlearning-settat.com
                                  Email: admission@itlearning-settat.com

                                                  Tél.:0661077812
   227   228   229   230   231   232   233   234   235   236   237