mb_internTask is a project focused on the calculation of plane figure squares. It provides a factory to get different figure implementations and calculate their squares.
To use the project, follow these steps:
- Use the figure factory to get the figure implementation.
- Call the
get_squarefunction on the figure implementation to calculate the square.
Python > 3.9
pytest - for tests
To extend the project by adding a new figure, follow these steps:
- Define a new figure class inherited from the abstract class
Figure. - Override the following functions:
get_square: Implement the logic to calculate the square of the figure.validate_arguments: Implement the logic to validate the arguments provided to the figure. Default case - pass the arguments to the super class.__str__: Implement the string representation of the figure.
from figures.FigureFactory import FigureFactory
# Get a figure implementation (e.g., Circle, Square, etc.)
figure_1 = FigureFactory.get_impl(2, 3, 4)
# Calculate the square
square = figure_1.get_square()
print(f'The square of the figure is: {square}')