Skip to content

Commit 7494a4f

Browse files
committed
A creational pattern (factory) updated coordinates class
1 parent db80fef commit 7494a4f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

app/coordinates.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
"""app.coordinates.py"""
2-
3-
class Latitude:
2+
class CoordinateFactory:
3+
def create_coordinate(creation_type:int, data:float):
4+
if creation_type == 1: new_coordinate = Latitude(data)
5+
if creation_type == 2: new_coordinate = Longitude(data)
6+
class Coordinate:
7+
pass
8+
class Latitude(Coordinate):
49
"""
510
A numeric representation of a latitudinal position north or south of the Earth's equator, to track Coronavirus spread nation to nation latitudinally.
611
"""
@@ -13,7 +18,7 @@ def sum(other: Latitude):
1318
def merge(other: Longitude):
1419
return Coordinates(self, other)
1520

16-
class Longitude:
21+
class Longitude(Coordinate):
1722
"""
1823
A numeric representation of a longitudinal position measuring east to west, to track Coronavirus spread nation to nation longitudinally
1924
"""

0 commit comments

Comments
 (0)