Tucancitto

Pb06. Angajați

Apr 19th, 2021
386
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. class Angajat
  6. {
  7. protected:
  8.     string nume, CNP;
  9.     int salariuBrut;
  10.     double impozit;
  11.  
  12. public:
  13.     Angajat() :
  14.         nume(""), CNP(""), salariuBrut(0), impozit(0) {}
  15.  
  16.     Angajat(string nume, string CNP, int salariuBrut, double impozit) :
  17.         nume(nume), CNP(CNP), salariuBrut(salariuBrut), impozit(impozit) {}
  18.  
  19.     void setNume(string nume)
  20.     {
  21.         this->nume = nume;
  22.     }
  23.  
  24.     void setCNP(string CNP)
  25.     {
  26.         this->CNP = CNP;
  27.     }
  28.  
  29.     void setSalariuBrut(int salariuBrut)
  30.     {
  31.         this->salariuBrut = salariuBrut;
  32.     }
  33.  
  34.     void setImpozit(double impozit)
  35.     {
  36.         this->impozit = impozit;
  37.     }
  38.  
  39.     string getNume()
  40.     {
  41.         return nume;
  42.     }
  43.  
  44.     string getCNP()
  45.     {
  46.         return CNP;
  47.     }
  48.  
  49.     int getSalariuBrut()
  50.     {
  51.         return salariuBrut;
  52.     }
  53.  
  54.     double getImpozit()
  55.     {
  56.         return impozit;
  57.     }
  58.  
  59.     void afisare()
  60.     {
  61.         cout << "Nume : " << nume << endl;
  62.         cout << "CNP : " << CNP << endl;
  63.         cout << "Salariul brut : " << salariuBrut << endl;
  64.         cout << "Impozit : " << impozit << endl;
  65.     }
  66.  
  67.     double calculSalariuNet()
  68.     {
  69.         return (double)(1 - impozit) * salariuBrut;
  70.     }
  71. };
  72.  
  73.  
  74. class AngajatTemporar : public Angajat
  75. {
  76. protected:
  77.     int oreLucrate, plataOra;
  78.  
  79. public:
  80.     AngajatTemporar() :
  81.         Angajat(), oreLucrate(0), plataOra(0) {}
  82.  
  83.     AngajatTemporar(string nume, string CNP, double impozit, int oreLucrate, int plataOra) :
  84.         Angajat(nume, CNP, oreLucrate* plataOra, impozit), oreLucrate(oreLucrate), plataOra(plataOra) {}
  85.  
  86.     void setOreLucrare(int oreLucrate)
  87.     {
  88.         this->oreLucrate = oreLucrate;
  89.     }
  90.  
  91.     void setPlataOra(int plataOra)
  92.     {
  93.         this->plataOra = plataOra;
  94.     }
  95.  
  96.     int getOreLucrare()
  97.     {
  98.         return oreLucrate;
  99.     }
  100.  
  101.     int getPlataOra()
  102.     {
  103.         return plataOra;
  104.     }
  105.  
  106.     void afisare()
  107.     {
  108.         Angajat::afisare();
  109.         cout << "Numar de ore lucrate : " << oreLucrate << endl;
  110.         cout << "Plata pe ora : " << plataOra << endl;
  111.     }
  112. };
  113.  
  114.  
  115. class AngajatPermanent : public Angajat
  116. {
  117. private:
  118.     int vechime, zileConcediu;
  119.  
  120. public:
  121.     AngajatPermanent() :
  122.         Angajat(), vechime(0), zileConcediu(0) {}
  123.  
  124.     AngajatPermanent(string nume, string CNP, int salariuBrut, double impozit, int vechime, int zileConcediu) :
  125.         Angajat(nume, CNP, salariuBrut, impozit), vechime(vechime), zileConcediu(zileConcediu) {}
  126.  
  127.     int getVechime()
  128.     {
  129.         return vechime;
  130.     }
  131.  
  132.     int getZileConcediu()
  133.     {
  134.         return zileConcediu;
  135.     }
  136.  
  137.     void afisare()
  138.     {
  139.         Angajat::afisare();
  140.         cout << "Vechime : " << vechime << endl;
  141.         cout << "Numar zile de concediu : " << zileConcediu << endl;
  142.     }
  143. };
  144.  
  145.  
  146. class AngajatConducere : public AngajatPermanent
  147. {
  148. private:
  149.     string functieConducere;
  150.     int indemnizatieSalariu;
  151. public:
  152.     AngajatConducere() :
  153.         AngajatPermanent(), functieConducere(""), indemnizatieSalariu(0) {}
  154.  
  155.     AngajatConducere(string nume, string CNP, int salariuBrut, double impozit, int vechime, int zileConcediu, string functieConducere, int indemnizatieSalariu) :
  156.         AngajatPermanent(nume, CNP, salariuBrut, impozit, vechime, zileConcediu), functieConducere(functieConducere), indemnizatieSalariu(indemnizatieSalariu) {}
  157.  
  158.     void afisare()
  159.     {
  160.         AngajatPermanent::afisare();
  161.         cout << "Functie de conducere : " << functieConducere << endl;
  162.         cout << "Indemnizatie salariu : " << indemnizatieSalariu << endl;
  163.     }
  164. };
  165.  
  166. int main()
  167. {
  168.     Angajat angajat("Popescu Florin", "5013678596785", 7000, 0.1);
  169.     angajat.afisare();
  170.     cout << "Salariul net : " << angajat.calculSalariuNet() << endl;
  171.     cout << endl;
  172.  
  173.     AngajatTemporar angajatTemporar("Gheorghe Marin", "5010543978612", 0.15, 200, 35);
  174.     angajatTemporar.afisare();
  175.     cout << "Salariul net : " << angajatTemporar.calculSalariuNet() << endl;
  176.     cout << endl;
  177.  
  178.     AngajatPermanent angajatPermanent("Marin Ana", "5023697840397", 8000, 0.1, 2, 24);
  179.     angajatPermanent.afisare();
  180.     cout << "Salariul net : " << angajatPermanent.calculSalariuNet() << endl;
  181.     cout << endl;
  182.  
  183.     AngajatConducere angajatConducere;
  184.     angajatConducere.afisare();
  185.     cout << "Salariul net : " << angajatConducere.calculSalariuNet() << endl;
  186.     cout << endl;
  187.  
  188.     // angajatPermanent = angajatConducere;
  189.     return 0;
  190. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×