diff --git a/Guia1/src/__pycache__/__init__.cpython-312.pyc b/Guia1/src/__pycache__/__init__.cpython-312.pyc index 5080441..c2e8914 100644 Binary files a/Guia1/src/__pycache__/__init__.cpython-312.pyc and b/Guia1/src/__pycache__/__init__.cpython-312.pyc differ diff --git a/Guia1/src/__pycache__/main.cpython-312.pyc b/Guia1/src/__pycache__/main.cpython-312.pyc index 6f42861..c4de38c 100644 Binary files a/Guia1/src/__pycache__/main.cpython-312.pyc and b/Guia1/src/__pycache__/main.cpython-312.pyc differ diff --git a/Guia1/src/config/__pycache__/__init__.cpython-312.pyc b/Guia1/src/config/__pycache__/__init__.cpython-312.pyc index 48f2979..88833c4 100644 Binary files a/Guia1/src/config/__pycache__/__init__.cpython-312.pyc and b/Guia1/src/config/__pycache__/__init__.cpython-312.pyc differ diff --git a/Guia1/src/config/__pycache__/settings.cpython-312.pyc b/Guia1/src/config/__pycache__/settings.cpython-312.pyc index 0fed221..818d552 100644 Binary files a/Guia1/src/config/__pycache__/settings.cpython-312.pyc and b/Guia1/src/config/__pycache__/settings.cpython-312.pyc differ diff --git a/Guia1/src/models/__pycache__/__init__.cpython-312.pyc b/Guia1/src/models/__pycache__/__init__.cpython-312.pyc index f2285cc..3d35f9b 100644 Binary files a/Guia1/src/models/__pycache__/__init__.cpython-312.pyc and b/Guia1/src/models/__pycache__/__init__.cpython-312.pyc differ diff --git a/Guia1/src/models/__pycache__/record.cpython-312.pyc b/Guia1/src/models/__pycache__/record.cpython-312.pyc index 42aff45..5a010ae 100644 Binary files a/Guia1/src/models/__pycache__/record.cpython-312.pyc and b/Guia1/src/models/__pycache__/record.cpython-312.pyc differ diff --git a/Guia1/src/models/record.py b/Guia1/src/models/record.py index 5c5bc4c..8f9a1cf 100644 --- a/Guia1/src/models/record.py +++ b/Guia1/src/models/record.py @@ -1,8 +1,22 @@ class Record: def __init__(self, record_id: int, name: str, address: str): - self._id = record_id - self._name = name - self._address = address + try: + id_convertido = int(record_id) + except (ValueError, TypeError): + raise ValueError("ID deve ser um número inteiro válido.") + + if id_convertido < 0: + raise ValueError(f'ID deve ser inteiro E positivo.') + + if not name or name.strip() == '': + raise ValueError(f'Nome não pode ser vazio.') + + if not address or address.strip() == '': + raise ValueError(f'Endereço não pode ser vazio.') + + self._id = id_convertido + self._name = name.strip() + self._address = address.strip() @property def id(self): @@ -15,6 +29,7 @@ def name(self): @property def address(self): return self._address - + + def __repr__(self): return f"Record(id={self._id}, name='{self._name}', address='{self._address}')" \ No newline at end of file diff --git a/Guia1/src/repositories/__pycache__/__init__.cpython-312.pyc b/Guia1/src/repositories/__pycache__/__init__.cpython-312.pyc index 219943d..bfbeb34 100644 Binary files a/Guia1/src/repositories/__pycache__/__init__.cpython-312.pyc and b/Guia1/src/repositories/__pycache__/__init__.cpython-312.pyc differ diff --git a/Guia1/src/repositories/__pycache__/abstract_repository.cpython-312.pyc b/Guia1/src/repositories/__pycache__/abstract_repository.cpython-312.pyc index 75a73ff..b805afd 100644 Binary files a/Guia1/src/repositories/__pycache__/abstract_repository.cpython-312.pyc and b/Guia1/src/repositories/__pycache__/abstract_repository.cpython-312.pyc differ diff --git a/Guia1/src/repositories/__pycache__/record_repository.cpython-312.pyc b/Guia1/src/repositories/__pycache__/record_repository.cpython-312.pyc index f76d38a..47e921e 100644 Binary files a/Guia1/src/repositories/__pycache__/record_repository.cpython-312.pyc and b/Guia1/src/repositories/__pycache__/record_repository.cpython-312.pyc differ diff --git a/Guia1/src/repositories/record_repository.py b/Guia1/src/repositories/record_repository.py index bded279..afaba5b 100644 --- a/Guia1/src/repositories/record_repository.py +++ b/Guia1/src/repositories/record_repository.py @@ -10,15 +10,35 @@ def __init__(self, file_path: str): def load_all(self): data = FileLoader.load_csv(self._file_path) - self._records = [ - Record(int(row["id"]), row["name"], row["address"]) - for row in data - ] + self._records = [] + for row in data: + try: + novo_registro = Record(row["id"], row["name"], row["address"]) + self._records.append(novo_registro) + except ValueError: + print(f"Registro inválido ignorado: {{'id': '{row['id']}', 'name': '{row['name']}', 'address': '{row['address']}'}}") + continue + return self._records def search(self, term: str): - term = term.lower() - return [ - r for r in self._records - if term in r.name.lower() or term in r.address.lower() - ] \ No newline at end of file + term_lista = term.lower().split() + + if not term_lista: + return [] + + resultados = [] + + for r in self._records: + palavras_do_registro = r.name.lower().split() + r.address.lower().split() + print(f'{palavras_do_registro}') + contem_todos = True + for palavra in term_lista: + if palavra not in palavras_do_registro: + contem_todos = False + break + + if contem_todos: + resultados.append(r) + + return resultados \ No newline at end of file diff --git a/Guia1/src/services/__pycache__/__init__.cpython-312.pyc b/Guia1/src/services/__pycache__/__init__.cpython-312.pyc index 7156b34..123b4f6 100644 Binary files a/Guia1/src/services/__pycache__/__init__.cpython-312.pyc and b/Guia1/src/services/__pycache__/__init__.cpython-312.pyc differ diff --git a/Guia1/src/services/__pycache__/record_service.cpython-312.pyc b/Guia1/src/services/__pycache__/record_service.cpython-312.pyc index 29288bf..88163aa 100644 Binary files a/Guia1/src/services/__pycache__/record_service.cpython-312.pyc and b/Guia1/src/services/__pycache__/record_service.cpython-312.pyc differ diff --git a/Guia1/src/utils/__pycache__/__init__.cpython-312.pyc b/Guia1/src/utils/__pycache__/__init__.cpython-312.pyc index 2548ac6..34da656 100644 Binary files a/Guia1/src/utils/__pycache__/__init__.cpython-312.pyc and b/Guia1/src/utils/__pycache__/__init__.cpython-312.pyc differ diff --git a/Guia1/src/utils/__pycache__/file_loader.cpython-312.pyc b/Guia1/src/utils/__pycache__/file_loader.cpython-312.pyc index 6b5ca6a..73497f3 100644 Binary files a/Guia1/src/utils/__pycache__/file_loader.cpython-312.pyc and b/Guia1/src/utils/__pycache__/file_loader.cpython-312.pyc differ diff --git a/Guia1/tests/__pycache__/__init__.cpython-312.pyc b/Guia1/tests/__pycache__/__init__.cpython-312.pyc index d4029fa..36a4562 100644 Binary files a/Guia1/tests/__pycache__/__init__.cpython-312.pyc and b/Guia1/tests/__pycache__/__init__.cpython-312.pyc differ diff --git a/Guia1/tests/__pycache__/test_runner.cpython-312.pyc b/Guia1/tests/__pycache__/test_runner.cpython-312.pyc index 5cc7ad8..683638b 100644 Binary files a/Guia1/tests/__pycache__/test_runner.cpython-312.pyc and b/Guia1/tests/__pycache__/test_runner.cpython-312.pyc differ diff --git a/Guia1/tests/test_runner.py b/Guia1/tests/test_runner.py index f8004a8..acbadee 100644 --- a/Guia1/tests/test_runner.py +++ b/Guia1/tests/test_runner.py @@ -53,7 +53,7 @@ def test_search_multiple_terms(self): try: self.service.get_all_records() - results = self.service.search("joao rua a") + results = self.service.search("joão rua a") if len(results) == 0: print("FALHA: Nenhum resultado encontrado") @@ -61,7 +61,7 @@ def test_search_multiple_terms(self): for r in results: text = (r.name + " " + r.address).lower() - if "joao" not in text or "rua" not in text or "a" not in text: + if "joão" not in text or "rua" not in text or "a" not in text: print("FALHA: Resultado incorreto na busca") return diff --git a/Guia2/src/__pycache__/__init__.cpython-314.pyc b/Guia2/src/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000..822db3f Binary files /dev/null and b/Guia2/src/__pycache__/__init__.cpython-314.pyc differ diff --git a/Guia2/src/folha_pagamento/__pycache__/__init__.cpython-314.pyc b/Guia2/src/folha_pagamento/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000..2c67547 Binary files /dev/null and b/Guia2/src/folha_pagamento/__pycache__/__init__.cpython-314.pyc differ diff --git a/Guia2/src/folha_pagamento/__pycache__/desenvolvedor.cpython-314.pyc b/Guia2/src/folha_pagamento/__pycache__/desenvolvedor.cpython-314.pyc new file mode 100644 index 0000000..7aba32b Binary files /dev/null and b/Guia2/src/folha_pagamento/__pycache__/desenvolvedor.cpython-314.pyc differ diff --git a/Guia2/src/folha_pagamento/__pycache__/estagiario.cpython-314.pyc b/Guia2/src/folha_pagamento/__pycache__/estagiario.cpython-314.pyc new file mode 100644 index 0000000..f57ee22 Binary files /dev/null and b/Guia2/src/folha_pagamento/__pycache__/estagiario.cpython-314.pyc differ diff --git a/Guia2/src/folha_pagamento/__pycache__/funcionario.cpython-314.pyc b/Guia2/src/folha_pagamento/__pycache__/funcionario.cpython-314.pyc new file mode 100644 index 0000000..ed28de1 Binary files /dev/null and b/Guia2/src/folha_pagamento/__pycache__/funcionario.cpython-314.pyc differ diff --git a/Guia2/src/folha_pagamento/__pycache__/gerente.cpython-314.pyc b/Guia2/src/folha_pagamento/__pycache__/gerente.cpython-314.pyc new file mode 100644 index 0000000..8d8dcb0 Binary files /dev/null and b/Guia2/src/folha_pagamento/__pycache__/gerente.cpython-314.pyc differ diff --git a/Guia2/src/folha_pagamento/desenvolvedor.py b/Guia2/src/folha_pagamento/desenvolvedor.py index 5c5d3c9..f284a47 100644 --- a/Guia2/src/folha_pagamento/desenvolvedor.py +++ b/Guia2/src/folha_pagamento/desenvolvedor.py @@ -1,6 +1,28 @@ from folha_pagamento.funcionario import Funcionario -# Desenvolva a classe Desenvolvedor aqui. +class Desenvolvedor(Funcionario): + def __init__(self, nome, matricula, salario_base, linguagem, senioridade): + super().__init__(nome, matricula, salario_base) + self.linguagem = linguagem + self.senioridade = senioridade -class Desenvolvedor: - pass \ No newline at end of file + def calcular_bonus(self): + if self.senioridade == 'junior': + return (self.salario_base * 0.05) + elif self.senioridade == 'pleno': + return (self.salario_base * 0.1) + elif self.senioridade == 'senior': + return (self.salario_base * 0.15) + + def calcular_descontos(self): + return (self.salario_base * 0.08) + + def calcular_adicionais(self): + if self.linguagem == 'Python': + return 500 + elif self.linguagem == 'Java': + return 400 + elif self.linguagem == 'JavaScript': + return 350 + else: + return 200 \ No newline at end of file diff --git a/Guia2/src/folha_pagamento/estagiario.py b/Guia2/src/folha_pagamento/estagiario.py index d50a433..6214b3e 100644 --- a/Guia2/src/folha_pagamento/estagiario.py +++ b/Guia2/src/folha_pagamento/estagiario.py @@ -1,6 +1,21 @@ from folha_pagamento.funcionario import Funcionario -# Desenvolva a classe Estagiario aqui. +class Estagiario(Funcionario): + def __init__(self, nome, matricula, salario_base, curso, carga_horaria): + super().__init__(nome, matricula, salario_base) + self.curso = curso + self.carga_horaria = carga_horaria -class Estagiario: - pass \ No newline at end of file + def calcular_bonus(self) -> float: + return (self.salario_base * 0.03) + + def calcular_descontos(self) -> float: + return (self.salario_base * 0.02) + + def calcular_adicionais(self) -> float: + if self.carga_horaria <= 20: + return 150 + elif self.carga_horaria <= 30: + return 250 + else: + return 350 \ No newline at end of file diff --git a/Guia2/src/folha_pagamento/gerente.py b/Guia2/src/folha_pagamento/gerente.py index 31819a1..7f4bce9 100644 --- a/Guia2/src/folha_pagamento/gerente.py +++ b/Guia2/src/folha_pagamento/gerente.py @@ -1,6 +1,26 @@ from folha_pagamento.funcionario import Funcionario -# Desenvolva a classe Gerente aqui. +class Gerente(Funcionario): + def __init__(self, nome, matricula, salario_base, setor, qtd_equipe): + super().__init__(nome, matricula, salario_base) + self.setor = setor + self.qtd_equipe = qtd_equipe -class Gerente: - pass \ No newline at end of file + def calcular_bonus(self): + if self.qtd_equipe <= 5: + return (self.salario_base * 0.1) + elif 5 < self.qtd_equipe <= 10: + return (self.salario_base * 0.15) + elif self.qtd_equipe > 10: + return (self.salario_base * 0.2) + + def calcular_descontos(self): + return (self.salario_base * 0.12) + + def calcular_adicionais(self): + if self.qtd_equipe > 10: + return 2000 + elif self.qtd_equipe > 5: + return 1000 + else: + return 500 \ No newline at end of file diff --git a/Guia2/tests/__pycache__/__init__.cpython-314.pyc b/Guia2/tests/__pycache__/__init__.cpython-314.pyc new file mode 100644 index 0000000..4de7bd1 Binary files /dev/null and b/Guia2/tests/__pycache__/__init__.cpython-314.pyc differ diff --git a/Guia2/tests/__pycache__/test_desenvolvedor.cpython-314-pytest-9.0.3.pyc b/Guia2/tests/__pycache__/test_desenvolvedor.cpython-314-pytest-9.0.3.pyc new file mode 100644 index 0000000..1612223 Binary files /dev/null and b/Guia2/tests/__pycache__/test_desenvolvedor.cpython-314-pytest-9.0.3.pyc differ diff --git a/Guia2/tests/__pycache__/test_estagiario.cpython-314-pytest-9.0.3.pyc b/Guia2/tests/__pycache__/test_estagiario.cpython-314-pytest-9.0.3.pyc new file mode 100644 index 0000000..a287e66 Binary files /dev/null and b/Guia2/tests/__pycache__/test_estagiario.cpython-314-pytest-9.0.3.pyc differ diff --git a/Guia2/tests/__pycache__/test_gerente.cpython-314-pytest-9.0.3.pyc b/Guia2/tests/__pycache__/test_gerente.cpython-314-pytest-9.0.3.pyc new file mode 100644 index 0000000..1271208 Binary files /dev/null and b/Guia2/tests/__pycache__/test_gerente.cpython-314-pytest-9.0.3.pyc differ