123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- """Calculate wage"""
- import json
- import operator
- from rival_regions_calc import Item, WorkProduction
- RESOURCEPRICE = 2500
- RESOURCE = Item("uranium")
- WP = WorkProduction(RESOURCE)
- WP.factory_level = 165
- WP.resource_max = 25
- WP.department_bonus = 7.2
- WP.wage_percentage = 100
- WP.tax_rate = 0
- def main():
- """Main function"""
- print("resource price : $ {:9}".format(RESOURCEPRICE))
- print("tax rate : {:9} %".format(WP.tax_rate))
- print("factory level : {:9}".format(WP.factory_level))
- print("department bonus : {:9} %".format(WP.department_bonus))
- print()
- workers = None
- with open('workers.json') as file:
- workers = json.load(file)
- for worker in workers.values():
- WP.user_level = worker['level']
- WP.work_exp = 80000 + 200 * worker['education']
- WP.calculate()
- worker['production'] = round(WP.wage())
- print(worker['production'])
- print('WORKER WAGE')
- print_worker_wage(workers)
- print()
- print('WORKER PRODUCTION')
- print_worker_production(workers)
- def print_worker_wage(workers):
- """Print worker wage percentage"""
- print("NAME % H PROFIT")
- for worker in workers.values():
- calculated_wage = worker['production'] * RESOURCEPRICE
- worker['procent'] = 100 / calculated_wage * worker['wage'] - 100
- worker['hour_difference'] = round(calculated_wage - worker['wage']) * 180
- for worker in sorted(workers.values(), key=operator.itemgetter('procent'), reverse=True):
- print("{:20}: {:6.2f} {:8,}kk".format(
- worker['name'],
- worker['procent'],
- round(worker['hour_difference'] / 1000000),
- ).replace(',', '.'))
- def print_worker_production(workers):
- """Calculate production"""
- print("NAME 24 H PROD %")
- for worker in sorted(workers.values(), key=operator.itemgetter('production'), reverse=True):
- print("{:20}: {:6,.0f} {:6.2f}".format(
- worker['name'],
- worker['production'] * 4320,
- 100 / 2400000000 * (worker['production'] * 4320),
- ).replace(',', '.'))
- if __name__ == "__main__":
- main()
|