Académique Documents
Professionnel Documents
Culture Documents
Classe : L2IT
Date : 18/12/2023
Enseignant : M. LOYA
Exercice 1
Question 1
//le fichier de déclaration employe.h
#ifndef EMPLOYE_H
#define EMPLOYE_H
#define SALFIXE 10000.
#include <string>
class Employe
{ std :: string nom,matricule;
int indice_salarial;
static double taux_sal;//donnée membre statique
public: Employe(std :: string n, std :: string m, int ind);
Employe():nom(""),matricule(""),indice_salarial(0){}
double salaire()const;
void afficher()const;
static void setTaux(double t);
static double gettaux();
void setNom(std :: string n){nom=n;}
std ::string getNom()const{return nom;}
std ::string getmatricule()const
{
return matricule;
}
~Employe();
};
#endif // EMPLOYE_H
void Employe::setTaux(double t)
{
if(t>0)
taux_sal=t;
}
double Employe::gettaux()
{
return taux_sal;
}
Employe::~Employe(){}
Question 2
//le fichier de déclaration responsable.h
#ifndef RESPONSABLE_H
#define RESPONSABLE_H
#include "Employe.h"
#include<vector>
void Responsable::afficherSub()const{
for(auto it:subordonnes)
it.afficher();
}
Question 3
//le fichier de déclaration commercial.h
#ifndef COMMERCIAL_H
#define COMMERCIAL_H
#include "Employe.h"
#endif // COMMERCIAL_H
float commercial::taux=0.02f;
void commercial::raz(){
_vente=0;
}
double commercial::salaire()const{
cout<<"classe Commercial"<<endl;
return Employe::salaire()+_vente*double(taux);
}
3.3