class TeoremaDePitagoras(Ecuacion):
    """ 
    pitagoras = TeoremaDePitagoras()


    print("\nDejar en blanco el valor desconocido")

    pitagoras.PedirLados()
    """
    def __init__(self):
        #sirve para asignar las variables de la superclase

        self._inputData = InputData()

    def Ejecutar(self):
        self.DefinirTriangulo()
        self.PedirLados()

    def DefinirTriangulo(self, a=None, b=None, c=None):
        return r"""
    |\
    | \
    |  \ h
  a |   \
    |    \
    |_ _ _\
      b
    
    a = %s
    b = %s
    h = %s""" % ("?" if a is None else a, "?" if b is None else b,
                 "?" if c is None else c)

    def PedirLados(self):
        a = self._inputData.ObtenerValorNumerico("a: ")
        b = self._inputData.ObtenerValorNumerico("b: ")

        if a is None or b is None:
            c = self._inputData.ObtenerValorNumerico("c: ")
        else:
            c = None

        isMenorQueDos = (bool(a) + bool(b) + bool(c)) < 2

        if c is None:
            data = float((a * a) + (b * b))
            c = sqrt(data)
        elif a is None:
            data = float((c * c) - (b * b))
            a = sqrt(data)
        elif b is None:
            data = float((c * c) - (a * a))
            b = sqrt(data)
        print("")

        print(self.DefinirTriangulo(a, b, c))

    def Calcular(self):
        pass
Пример #2
0
class Distancia:
    def __init__(self):
        super().__init__()
        self._inputData = InputData()
    
    def Ejecutar(self):
        vIncial = self._inputData.ObtenerValorNumerico("Ingrese la velocidad inicial: ")
        tiempo = self._inputData.ObtenerValorNumerico("Ingrese el tiempo que se tardo: ")
        aceleracion = self._inputData.ObtenerValorNumerico("Ingrese la aceleracion del objeto: ")

        distancia = (vIncial*tiempo) + 0.5*(aceleracion*(tiempo**2))
        print(f"La distancia es: {distancia}")
Пример #3
0
class VolumenCono:
    def __init__(self):
        super().__init__()
        self._inputData = InputData()
    
    def Ejecutar(self):
        radio = self._inputData.ObtenerValorNumerico("Ingrese el radio: ")
        altura = self._inputData.ObtenerValorNumerico("Ingrese el valor la altura: ")

        arg = (math.pi* math.pow(radio,2))
        volumen=(arg*altura)/3
        print(f"El volumen del cono es {volumen}")
Пример #4
0
class AlturaObjeto:
    def __init__(self):
        super().__init__()
        self._inputData = InputData()

    def Ejecutar(self):
        vInicial = self._inputData.ObtenerValorNumerico(
            "Ingrese la velocidad inicial: ")
        tiempo = self._inputData.ObtenerValorNumerico(
            "Ingrese el tiempo que se tardo: ")

        distancia = vInicial * tiempo - (0.5 * (-9.8)) * tiempo**2
        print(f"La altura del objeto {distancia}")
Пример #5
0
class VelocidadFinal:
    def __init__(self):
        super().__init__()
        self._inputData = InputData()


    def Ejecutar(self):
        vInicial = self._inputData.ObtenerValorNumerico("Ingrese la velocidad inicial: ")
        aceleracion = self._inputData.ObtenerValorNumerico("Ingrese aceleracion: ")
        tiempo = self._inputData.ObtenerValorNumerico("Ingrese el tiempo que se tardo: ")

        vFinal = vInicial + (aceleracion*tiempo)
        print(f"La velocidad final {vFinal}")
Пример #6
0
class VolumenEsfera:
    def __init__(self):
        super().__init__()
        self._inputData = InputData()

    def Ejecutar(self):
        radio = self._inputData.ObtenerValorNumerico("Ingrese el radio: ")
        volumen = (4 / 3) * pi * radio**3
        print(f"El volumen de la esfera es {volumen}")
Пример #7
0
class AceleracionMedia:
    def __init__(self):
        super().__init__()
        self._inputData = InputData()

    def Ejecutar(self):
        vFinal = self._inputData.ObtenerValorNumerico(
            "Ingresar velocidad final: ")
        vIncial = self._inputData.ObtenerValorNumerico(
            "Ingresar velocidad inicial: ")

        tFinal = self._inputData.ObtenerValorNumerico(
            "Ingresar el tiempo final: ")
        tIncial = self._inputData.ObtenerValorNumerico(
            "Ingresar el tiempo inicial: ")

        aceleracion = (vFinal - vIncial) / (tFinal - tIncial)

        print(f"La aceleracion media es {aceleracion}")
Пример #8
0
class TiempoCaida:
    def __init__(self):
        super().__init__()
        self._inputData = InputData()

    def Ejecutar(self):
        altura = self._inputData.ObtenerValorNumerico("Ingrese la altura: ")

        arg = 2 * (altura / 9.8)
        tiempo = math.sqrt(arg)
        print(f"el tiempo que tardo el objeto es {tiempo}")
Пример #9
0
class VolumenCubo:
    def __init__(self):
        super().__init__()
        self._inputData = InputData()

    def Ejecutar(self):
        lado = self._inputData.ObtenerValorNumerico(
            "Ingrese el valor del lado del cubo: ")
        volumen = float((lado**3))

        print(f"El volumen del cubo es {volumen}")
Пример #10
0
 def __init__(self):
     super().__init__()
     self._inputData = InputData()
    def __init__(self):
        #sirve para asignar las variables de la superclase

        self._inputData = InputData()