payroll.py - from abc import ABC, abstractmethod import os...

This preview shows page 1 - 2 out of 4 pages.

from abc import ABC, abstractmethodimport osPAY_LOGFILE = 'paylog.txt'emps = {}def load_employees():with open('employees.csv', 'r') as fin:lines = fin.readlines()lines.pop(0)for line in lines:line = line.strip()v = line.split(',')emp = Employee(v[0], v[1], v[2], v[3], v[4], v[5], v[6])if v[7] == '1':emp.make_salaried(float(v[8]))elif v[7] == '2':emp.make_commissioned(float(v[8]), float(v[9]))else:emp.make_hourly(float(v[10]))emps[v[0]] = empdef process_timecards():with open('timecards.csv', 'r') as fin:lines = fin.readlines()for line in lines:line = line.strip()tcs = line.split(',')emp_id = tcs.pop(0)emp = find_employee_by_id(emp_id)classification = emp.classificationfor tc in tcs:classification.add_timecard(float(tc))def process_receipts():with open('receipts.csv', 'r') as fin:lines = fin.readlines()for line in lines:line = line.strip()receipts = line.split(',')emp_id = receipts.pop(0)emp = find_employee_by_id(emp_id)classification = emp.classificationfor receipt in receipts:classification.add_receipt(float(receipt))def run_payroll():if os.path.exists(PAY_LOGFILE):os.remove(PAY_LOGFILE)

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 4 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
CharlesD.Allison
Tags
Payment, Returning, emp

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture