Untitled

mail@pastecode.io avatar
unknown
python
3 years ago
705 B
8
Indexable
Never
from abc import ABC
from enum import Enum, auto


class DiscriminantStrategy(ABC):
    def calculate_discriminant(self, a, b, c):
        pass


# TODO - how to abstract out the discriminant formulae because it is repeating in both (all) strategies!
class OrdinaryDiscriminantStrategy(DiscriminantStrategy):
    def calculate_discriminant(self, a, b, c):
        
        d = (b ** 2) - 4 * a * c        # how to abstract this out
        # some logic


class RealDiscriminantStrategy(DiscriminantStrategy):
    def calculate_discriminant(self, a, b, c):
        
        d = (b ** 2) - 4 * a * c        # # how to abstract this out
        # some logic...

class QuadraticEquationSolver:
    # som elogic