-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroller.py
57 lines (50 loc) · 2.1 KB
/
controller.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from team import TimeDeFutebol
class Controller:
def inserir(nome, estado, titulos, folha_pagamento):
return TimeDeFutebol(nome, estado, titulos, folha_pagamento)
def listar(listaTimes):
print(' NOME | ESTADO | QTD. TITULOS | FOLHA DE PGTO.')
print('--------------------------------------')
for time in listaTimes:
print(
f'{time.getNome()} | {time.getEstado()} | {time.getTitulos()}\t\t\t | R$ {time.getFolhaPagamento():.2f}')
print('--------------------------------------')
def pesquisaNome(listaTimes, nome):
contador = 0
for time in listaTimes:
if time.getNome() == nome:
print(f'Nome: {time.getNome()}')
print(f'Estado: {time.getEstado()}')
print(f'Qtd. de Titulos: {time.getTitulos()}')
print(f'Valor da Folha de Pgto.: R$ {time.getFolhaPagamento():.2f}')
break
else:
print(f'Time {nome} não cadastrado no sistema!')
contador += 1
def deleteAll(listaTimes):
if len(listaTimes) != 0:
listaTimes.clear()
return 'Todos os times foram removidos!'
else:
return 'A lista de times está vazia!'
def deleteNome(listaTimes, nome):
if len(listaTimes) != 0:
cont = 0
for time in listaTimes:
if time.getNome() == nome:
listaTimes.pop(cont)
return f'Time {nome} removido com sucesso!'
else:
return 'Time não encontrado!'
else:
return 'Lista de times está vazia!'
def atualizaFolha(listaTimes, nome, valor):
if len(listaTimes) != 0:
for time in listaTimes:
if time.getNome() == nome:
time.setFolhaPagamento(valor)
return f'Valor da folha de pagamento do time {nome} atualizado com sucesso!'
else:
return 'Time não encontrado!'
else:
return 'Lista de times está vazia!'