Advertisement
Gireada

POO L3.1

Mar 14th, 2017
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class angajat
  6. {
  7.     float net, brut, ore, tarif;
  8.     public:
  9.     void introdu();
  10.     float calculeaza(float brut, float ore, float tarif);
  11.     void afisare();
  12. } angajati;
  13.  
  14. void angajat::introdu()
  15. {
  16.     cout << "Introdu salariul brut: ";cin >> angajati.brut;
  17.     cout << "\nIntrodu numarul de ore: ";cin >> angajati.ore;
  18.     cout << "\nIntrodu tariful: ";cin >> angajati.tarif;
  19. }
  20.  
  21. float angajat::calculeaza(float brut, float ore, float tarif)
  22. {
  23.     float rezultat = 0.00;
  24.     rezultat = (brut * 70) / 100 + tarif * ore;
  25.     return rezultat;
  26. }
  27.  
  28. void angajat::afisare()
  29. {
  30.     cout << "\nSalariul este de: " << float(angajati.calculeaza(angajati.brut, angajati.ore, angajati.tarif));
  31. }
  32.  
  33. int main()
  34. {
  35.     angajati.introdu();
  36.     angajati.afisare();
  37.     system("pause");
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement