Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
A creational pattern (factory) updated coordinates class
  • Loading branch information
shaynmorgan committed Aug 16, 2021
commit 7494a4fa4e1c9c20bbe0c11f7baebd83f3d5009d
11 changes: 8 additions & 3 deletions app/coordinates.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
"""app.coordinates.py"""

class Latitude:
class CoordinateFactory:
def create_coordinate(creation_type:int, data:float):
if creation_type == 1: new_coordinate = Latitude(data)
if creation_type == 2: new_coordinate = Longitude(data)
class Coordinate:
pass
class Latitude(Coordinate):
"""
A numeric representation of a latitudinal position north or south of the Earth's equator, to track Coronavirus spread nation to nation latitudinally.
"""
Expand All @@ -13,7 +18,7 @@ def sum(other: Latitude):
def merge(other: Longitude):
return Coordinates(self, other)

class Longitude:
class Longitude(Coordinate):
"""
A numeric representation of a longitudinal position measuring east to west, to track Coronavirus spread nation to nation longitudinally
"""
Expand Down