Skip to content

Instantly share code, notes, and snippets.

@heisvoid
Last active August 29, 2015 14:26
Show Gist options
  • Select an option

  • Save heisvoid/fe0b3c72c832dedbbcb4 to your computer and use it in GitHub Desktop.

Select an option

Save heisvoid/fe0b3c72c832dedbbcb4 to your computer and use it in GitHub Desktop.
Property tax calculator for Daepyong building
HOUSE_TAX_TABLE = ((60, 1), (90, 1.5), (150, 2.5), (float('inf'), 4.0))
RESOURCE_TAX_TABLE = ((6, 0.4), (7, 0.5), (13, 0.6), (13, 0.8), (25, 1.0), (float('inf'), 1.2))
LAND_AREA = 324.7
LAND_UNIT_PRICE = 788000
BUILDING_AREA = 490.86
BUSINESS_AREA = 173.91
BUSINESS_UNIT_PRICE = 764000
HOUSE_AREAS = (6.09, 114.96, 40.47, 114.96, 40.47)
HOUSE_UNIT_PRICE = 637000
HOUSE_WITH_LAND_PRICE = 337000000
def get_progressive_tax(table, basis):
s = 0
for i, j in table:
if 0 >= basis:
break
tmp = min(1000000 * i, basis)
s = s + tmp * j / 1000
basis = basis - tmp
return s
# business building
basis = BUSINESS_AREA * BUSINESS_UNIT_PRICE * 1.1 * 0.7
principal = basis * 2.5 / 1000
education = principal * 0.2
city = basis * 1.4 / 1000
resource = get_progressive_tax(RESOURCE_TAX_TABLE, basis)
total = principal + education + city + resource
print("business")
print("son: %d, mom: %d" % (total / 2, total / 2))
# house
total_house_area = 0
for i in HOUSE_AREAS:
total_house_area = total_house_area + i
house_land_area = LAND_AREA * total_house_area / (total_house_area + BUSINESS_AREA)
principal_list = []
education_list = []
city_list = []
resource_list = []
son_sum = 0
mom_sum = 0
for i in HOUSE_AREAS:
basis = HOUSE_WITH_LAND_PRICE * 0.6 * i / total_house_area
land_price = LAND_UNIT_PRICE * LAND_AREA * i / (total_house_area + BUSINESS_AREA)
building_price = HOUSE_UNIT_PRICE * i
son_rate = building_price / (land_price + building_price) / 2
tax = get_progressive_tax(HOUSE_TAX_TABLE, basis)
son_tax = tax * son_rate
mom_tax = tax - son_tax
principal_list.append((son_tax, mom_tax))
son_sum = son_sum + son_tax
mom_sum = mom_sum + mom_tax
son_tax = son_tax * 0.2
mom_tax = mom_tax * 0.2
education_list.append((son_tax, mom_tax))
son_sum = son_sum + son_tax
mom_sum = mom_sum + mom_tax
tax = basis * 1.4 / 1000
son_tax = tax * son_rate
mom_tax = tax - son_tax
city_list.append((son_tax, mom_tax))
son_sum = son_sum + son_tax
mom_sum = mom_sum + mom_tax
basis = building_price * 0.6
tax = get_progressive_tax(RESOURCE_TAX_TABLE, basis)
son_tax = tax / 2
mom_tax = tax / 2
resource_list.append((son_tax, mom_tax))
son_sum = son_sum + son_tax
mom_sum = mom_sum + mom_tax
print("house")
print("son: %d, mom: %d" % (son_sum, mom_sum))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment