Created
June 2, 2021 13:22
-
-
Save prp-e/1ef085a56f2ccc3a579f51bad8caa9d5 to your computer and use it in GitHub Desktop.
Employee Project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Employee | |
def __init__(self, salary:float) | |
self.salary = salary | |
def calTax(self): | |
self.tax = 0 | |
if self.salary <= 2300000: | |
self.tax = 0 | |
elif 2300000 < self.salary <= 5000000: | |
self.tax = self.salary * 10 / 100 | |
elif self.salary > 5000000: | |
base_tax = (self.salary - 5000000) * 10 / 100 | |
self.tax = base_tax + (self.tax * 20 / 100) | |
return self.tax | |
def calInsurance(self): | |
return self.insurance_fee = self.salary * 10 / 100 | |
def show_information(self): | |
return { "salary" : self.salary, "insurance" : self.calInsurance(self.salary), "tax": self.calTax(self.salary)} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment