Untitled

 avatar
unknown
python
4 years ago
705 B
11
Indexable
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
Editor is loading...