From 86c8f62d985a389232c9506a0a000ff020eb2d31 Mon Sep 17 00:00:00 2001 From: zeguii Date: Thu, 28 May 2026 23:22:07 -0300 Subject: [PATCH 1/2] 28/05 --- Guia3/src/perguntadiscursiva.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Guia3/src/perguntadiscursiva.py b/Guia3/src/perguntadiscursiva.py index f4c26af..56ab259 100644 --- a/Guia3/src/perguntadiscursiva.py +++ b/Guia3/src/perguntadiscursiva.py @@ -1,4 +1,19 @@ from typing import List, Tuple, Dict -class PerguntaDiscursiva: - pass \ No newline at end of file +from Guia3.src.pergunta import Pergunta + +class PerguntaDiscursiva(Pergunta): + def __init__(self, texto: str, explicacao_geral: str, resposta_certa: str): + super().__init__(texto, explicacao_geral) + self.resposta_certa = resposta_certa + + def validar_resposta(self, resposta: str) -> bool: + return resposta == self.resposta_certa + + def get_explicacao(self) -> str: + return self.explicacao_geral + + def get_tipo(self) -> str: + return "Discursiva" + + \ No newline at end of file From 78b0a39b757c3854c5ce124c7b5d8ded09dee821 Mon Sep 17 00:00:00 2001 From: zeguii Date: Thu, 28 May 2026 23:22:16 -0300 Subject: [PATCH 2/2] 28/05 --- Guia3/src/alternativa.py | 4 ++++ Guia3/src/pergunta.py | 19 +++++++++++++++++-- Guia3/src/perguntamultiplaescolha.py | 20 ++++++++++++++++++-- Guia3/src/resposta.py | 12 ++++++++++-- Guia3/src/respostadiscursiva.py | 10 ++++++++-- Guia3/src/respostaobjetiva.py | 12 ++++++++++-- 6 files changed, 67 insertions(+), 10 deletions(-) diff --git a/Guia3/src/alternativa.py b/Guia3/src/alternativa.py index 4dde61f..5547702 100644 --- a/Guia3/src/alternativa.py +++ b/Guia3/src/alternativa.py @@ -1,4 +1,8 @@ from typing import List, Tuple, Dict class Alternativa: + def __init__(self, texto: str, correta: bool, explicacao: str): + self.texto = texto + self.correta = correta + self.explicacao = explicacao pass \ No newline at end of file diff --git a/Guia3/src/pergunta.py b/Guia3/src/pergunta.py index 5b3763d..a06e6df 100644 --- a/Guia3/src/pergunta.py +++ b/Guia3/src/pergunta.py @@ -1,4 +1,19 @@ from typing import List, Tuple, Dict +from abc import ABC, abstractmethod -class Pergunta: - pass \ No newline at end of file +class Pergunta(ABC): + def __init__(self, texto: str, explicacao_geral: str): + self.texto = texto + self.explicacao_geral = explicacao_geral + + @abstractmethod + def validarr_resposta(self, resposta: str) -> bool: + pass + + @abstractmethod + def get_explicacao(self) -> str: + pass + + @abstractmethod + def get_tipo(self) -> str: + pass \ No newline at end of file diff --git a/Guia3/src/perguntamultiplaescolha.py b/Guia3/src/perguntamultiplaescolha.py index bcbe94d..aa5a2af 100644 --- a/Guia3/src/perguntamultiplaescolha.py +++ b/Guia3/src/perguntamultiplaescolha.py @@ -1,4 +1,20 @@ from typing import List, Tuple, Dict -class PerguntaMultiplaEscolha: - pass \ No newline at end of file +from Guia3.src.pergunta import Pergunta + +class PerguntaMultiplaEscolha(Pergunta): + def __init__(self, texto: str, explicacao_geral: str, alternativas: List[Dict[str, str]]): + super().__init__(texto, explicacao_geral) + self.alternativas = alternativas + + def validar_resposta(self, resposta: str) -> bool: + for alternativa in self.alternativas: + if alternativa['texto'] == resposta: + return alternativa['correta'] + return False + + def get_explicacao(self) -> str: + return self.explicacao_geral + + def get_tipo(self) -> str: + return "Multipla Escolha" \ No newline at end of file diff --git a/Guia3/src/resposta.py b/Guia3/src/resposta.py index 846d771..2fb3738 100644 --- a/Guia3/src/resposta.py +++ b/Guia3/src/resposta.py @@ -1,4 +1,12 @@ from typing import List, Tuple, Dict +from abc import ABC, abstractmethod +class Resposta(ABC): + def __init__(self, pergunta: str,esta_correta: bool,pontuacao_obtida: int): + self.pergunta = pergunta + self.esta_correta = esta_correta + self.pontuacao_obtida = pontuacao_obtida -class Resposta: - pass \ No newline at end of file + + @abstractmethod + def calcular_pontuacao(self) -> int: + pass \ No newline at end of file diff --git a/Guia3/src/respostadiscursiva.py b/Guia3/src/respostadiscursiva.py index 4ea6dbb..da9e017 100644 --- a/Guia3/src/respostadiscursiva.py +++ b/Guia3/src/respostadiscursiva.py @@ -1,4 +1,10 @@ from typing import List, Tuple, Dict -class RespostaDiscursiva: - pass \ No newline at end of file +from Guia3.src.resposta import Resposta + +class RespostaDiscursiva(Resposta): + def __init__(self, pergunta: str, esta_correta: bool, pontuacao_obtida: int): + super().__init__(pergunta, esta_correta, pontuacao_obtida) + + def calcular_pontuacao(self) -> int: + return self.pontuacao_obtida \ No newline at end of file diff --git a/Guia3/src/respostaobjetiva.py b/Guia3/src/respostaobjetiva.py index 72ed2d0..93f28a9 100644 --- a/Guia3/src/respostaobjetiva.py +++ b/Guia3/src/respostaobjetiva.py @@ -1,4 +1,12 @@ from typing import List, Tuple, Dict -class RespostaObjetiva: - pass \ No newline at end of file +from Guia3.src.resposta import Resposta + +class RespostaObjetiva(Resposta): + def __init__(self, pergunta: str, esta_correta: bool, pontuacao_obtida: int): + super().__init__(pergunta, esta_correta, pontuacao_obtida) + + def calcular_pontuacao(self) -> int: + return self.pontuacao_obtida + + \ No newline at end of file