Skip to content

Instantly share code, notes, and snippets.

@jonascheng
Last active June 9, 2019 15:27
Show Gist options
  • Save jonascheng/cf03804be82bf7f90169dc081ecb6bb4 to your computer and use it in GitHub Desktop.
Save jonascheng/cf03804be82bf7f90169dc081ecb6bb4 to your computer and use it in GitHub Desktop.
SOLID-EmployeeClass
import datetime
class Employee:
def __init__(self, first_name: str , last_name: str, birth: datetime, hourly_rate: int, labor_hours: int):
self.first_name = first_name
self.last_name = last_name
self.birth = birth
self._hourly_rate = hourly_rate
self._labor_hours = labor_hours
@property
def first_name(self):
return self._first_name
@first_name.setter
def first_name(self, first_name):
self._first_name = first_name.capitalize()
@property
def last_name(self):
return self._last_name
@last_name.setter
def last_name(self, last_name):
self._last_name = last_name.capitalize()
@property
def wage(self):
return self._hourly_rate * self._labor_hours
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment