Skip to content

Commit daee844

Browse files
committed
Class Dipendente
1 parent c1831f9 commit daee844

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

Dipendente.py

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
from ast import match_case
2+
3+
4+
class Dipendente(Lavoratore):
5+
def __init__(self,nome, cognome, data_nascita, sesso, peso, idbadge, mansione, livello):
6+
super().__init__(nome, cognome, data_nascita, sesso, peso, idbadge, mansione)
7+
self._livello = livello
8+
logger.info("E' stato inserito un dipendente.")
9+
10+
def __str__(self):
11+
return super().__str__() + ' ' + self._livello
12+
13+
def __eq__(self, other):
14+
if isinstance(other, Dipendente):
15+
if super().__eq__(other) and other._livello == self._livello:
16+
return True
17+
return False
18+
19+
def __hash__(self):
20+
return hash((super().__hash__(), self._livello))
21+
22+
def get_livello(self):
23+
return self._livello
24+
25+
def set_idbadge(self, x):
26+
Lavoratore.check_id(x)
27+
self._livello = x
28+
29+
@staticmethod
30+
def check_liv(liv):
31+
if isinstance(liv,int) and liv>0:
32+
pass
33+
else:
34+
raise('Inserire un livello corretto')
35+
36+
def calcolo_stipendio(self, mansione, livl):
37+
item = [mansione, livl]
38+
match item:
39+
case [7, 'addetto pulizie']:
40+
stipendio = 1275.00
41+
case [7, 'inserviente']:
42+
stipendio = 1230.00
43+
case [6, 'operaio comune']:
44+
stipendio = 1392.00
45+
case [6, 'fattorino']:
46+
stipendio = 1359.00
47+
case [5, 'impiegato']:
48+
stipendio = 1476.00
49+
case [5, 'operaio qualificato']:
50+
stipendio = 1494.00
51+
case [4, "impiegato d'ordine"]:
52+
stipendio = 1600.00
53+
case [4, 'operaio specialzzato']:
54+
stipendio = 1610.00
55+
case [3, 'impiegato di concetto']:
56+
stipendio = 1772.00
57+
case [3, 'operaio specializzato provetto']:
58+
stipendio = 1789.00
59+
case [2, 'impiegato autonomo']:
60+
stipendio = 1988.00
61+
case [2, 'impiegato direttivo']:
62+
stipendio = 1979.00
63+
case [1, 'manager']:
64+
stipendio = 2670.00
65+
case [1, 'direttore']:
66+
stipendio = 2790.00
67+
case [1, 'responsabile']:
68+
stipendio = 2390.00
69+
case _:
70+
return ("Errore nel calcolo dello stipendio")
71+
return stipendio

0 commit comments

Comments
 (0)