-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path14.py
28 lines (22 loc) · 816 Bytes
/
14.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#Exercicio 14
'''
Aprimore a classe do exercício anterior para adicionar o método aumentarSalario (porcentualDeAumento) que aumente o salário do funcionário em uma certa porcentagem.
Exemplo de uso:
harry=funcionário("Harry",25000)
harry.aumentarSalario(10)
'''
class Funcionario:
def __init__(self, nome, salario):
self.nome = nome
self.salario = float(salario)
def getNome(self):
return self.nome
def getSalario(self):
return self.salario
def aumentarSalario(self, percentualDeAumento):
self.salario += self.salario * (percentualDeAumento / 100.0)
#Teste Classe
harry = Funcionario("Harry", 25000)
harry.aumentarSalario(10)
print (f'Nome: {harry.getNome()}')
print (f'Salario: R$ {harry.getSalario():.2f}')