def add_emp(emps):

    print('Add an employee.')
    num = input('Num: ')

    if num not in emps:
        name = input('Name: ')


        print('Choose a title:',\
              '\n1) Production Worker',\
              '\n2) Shift Supervisor')
        title = int(input('Select 1 or 2: '))

        if title == 1:
            shift = int(input('Shift 1 or 2: '))
            payrate = input('Pay: ')

            emps[num] = employee.ProductionWorker(name, num, shift, payrate)

        elif title == 2:
            salary = input('Salary: ')
            bonus = input('Bonus: ')

            emps[num] = employee.ShiftSupervisor(name, num, salary, bonus)

        print('Employee successfully added to file.')
    else:
        print('Employee already exists')
def main():

    # Create an employee object, a shift supervisor object
    supervisor = employee.ShiftSupervisor("John", "1", 50000, 1000)

    # Display employee data
    print("Employee Data - ")
    print("Name:", supervisor.get_name())
    print("ID:", supervisor.get_id())
    print("Salary:", supervisor.get_salary())
    print("Bonus:", supervisor.get_bonus())
示例#3
0
def main():
    # Variables
    s_name = ''
    s_id = ''
    s_salary = 0.0
    s_bonus = 0.0

    w_name = ''
    w_id = ''
    w_shift = 0
    w_pay = 0.0
    w_hours = 0.0

    choice = 0

    display_menu()
    choice = int(input('Enter your choice: '))

    while choice != 3:
        if choice == 1:
            w_name = input('Enter the Employee Name: ')
            w_id = input('Enter the Employee ID: ')
            w_shift = int(input('Enter the Employee shift number: '))
            w_pay = float(input('Enter the Employee pay rate: '))
            w_hours = float(input('Enter the hours the Employee worked: '))

            worker = employee.ProductionWorker(w_name, w_id, w_shift, w_pay, w_hours)

            print('Production Worker Information')
            print('Name:', worker.get_name())
            print('ID Number:', worker.get_id_number())
            print('Shift Number:', worker.get_shift_number())
            print('Hourly Pay Rate: $', format(worker.get_pay_rate(), ',.2f'), sep='')
            print('Gross Weekly Pay: $', format(worker.get_weekly_pay(), ',.2f'), sep='')

        elif choice == 2:
            s_name = input('Enter the Name: ')
            s_id = input('Enter the ID Number: ')
            s_salary = float(input('Enter the Salary: '))
            s_bonus = float(input('Enter the Bonus Amount: '))

            supervisor = employee.ShiftSupervisor(s_name, s_id, s_salary, s_bonus)

            print('Shift Supervisor Information')
            print('Name:', supervisor.get_name())
            print('ID Number:', supervisor.get_id_number())
            print('Annual Salary: $', format(supervisor.get_salary(), ',.2f'), sep='')
            print('Bonus Amount: $', format(supervisor.get_bonus(), ',.2f'), sep='')
            print('Gross Weekly Pay: $', format(supervisor.get_weekly_pay(), ',.2f'), sep='')

        display_menu()
        choice = int(input('Enter your choice: '))
def make_shift_supervisor(data, i_action):
    '''
    Create a shift supervisor out of the employee specified by data.
    @return False to fall back to the main menu
    '''
    employees = data['employees']
    index = data['index']
    old_employee = employees[index]
    employees[index] = employee.ShiftSupervisor()
    employees[index].set_name(old_employee.get_name())
    employees[index].set_employee_no(old_employee.get_employee_no())
    # tell the user
    print('Update:', get_employee_titled_name(employees, index), end='')
    print(' is now a shift supervisor.')
    print()
    return False
示例#5
0
def main():
    emp1 = employee.Employee("Bill Smith", 1000)
    print("Employee 1\n", emp1)

    print("\n", end='')

    pw1 = employee.ProductionWorker("Jim Jones", 2000, 1, 14)
    print("Production Worker 1\n", pw1)

    print("\n", end='')

    ss1 = employee.ShiftSupervisor("Bob Adams", 3000, 10000, 5000)
    print("Shift Supervisor 1\n", ss1)
    print(" totalBonus = $", ss1.calculate_bonus(), sep='')

    print("\n", end='')
示例#6
0
def main():

    name = input('Имя: ')
    id = int(input('ИД: '))
    salary = float(input('Годовой оклад: '))
    bonus  =float(input('Премия: '))

    # Создаю эезепляр и предаю в него полученные
    # данные выше.
    shiftsuper = employee.ShiftSupervisor(name, id, salary, bonus)

    print()
    print('У нас есть начальник смены который достоен премии:')
    print('Имя:', shiftsuper.get_name(), '\n',
          'ID:', shiftsuper.get_id(), '\n',
          'Годовой оклад:', shiftsuper.get_annual_salary(), '\n',
          'Ему начислен бонус:', shiftsuper.get_production_bonus())
示例#7
0
def modify_sup_fn(supervisors_all):
    another = 'Y'
    while another.upper() == 'Y':
        name = input("Please enter the Supervisor's name: ")

        if name in supervisors_all:
            emp_id = input("Please enter the Supervisor's new ID: ")
            employee1 = employee.Employee(name, emp_id)
            salary = input("Please enter the Supervisor's new salary: $")
            bonus = input("Please enter the Supervisor's new entitled bonus: $")
            supervisor = employee.ShiftSupervisor(name, emp_id, salary, bonus)
            supervisors_all[name] = supervisor
            print("Supervisor successfully modified")
        else:
            print('ERROR: Supervisor not found')
        print()
        print('Do you want to modify another Supervisor?')
        another = input('Y or N: ')
        print()

    save_pickle_sup(supervisors_all)
示例#8
0
def main():

    # retrieves data attributes for the worker
    name = input("Enter the worker's name: ")
    ID = int(input("Enter the worker's ID number: "))
    shift = int(input("Enter the worker's shift number: "))
    payRate = float(input("Enter the worker's hourly pay rate: "))

    worker = employee.ProductionWorker(name, ID, shift,
                                       payRate)  # creates the worker object

    # retrieves data attributes for the supervisor
    name = input("Enter the supervisor's name: ")
    ID = int(input("Enter the supervisor's ID number: "))
    salary = float(input("Enter the supervisor's annual salary: "))
    bonus = float(input("Enter the supervisor's bonus: "))

    supervisor = employee.ShiftSupervisor(
        name, ID, salary, bonus)  # creates the supervisor object

    printWorker(worker)  # prints the worker's data attributes
    printSupervisor(supervisor)  # prints the supervisor's data attributes
示例#9
0
def add_sup_fn(supervisors_all):

    another = 'Y'
    while another.upper() == 'Y':
        name = input("Please enter the Supervisor's name: ")

        if name not in supervisors_all:
            emp_id = input("Please enter the Supervisor's ID: ")
            employee1 = employee.Employee(name, emp_id)
            salary = input("Please enter the Supervisor's salary: $")
            bonus = input("Please enter the Supervisor's entitled bonus: $")
            supervisor = employee.ShiftSupervisor(name, emp_id, salary, bonus)
            supervisors_all[name] = supervisor
            print("Supervisor successfully added")
        else:
            print("ERROR: Supervisor already exists")
            print()
        print('Do you want to add another Supervisor?')
        another = input('Y or N: ')
        print()

    save_pickle_sup(supervisors_all)
示例#10
0
def main():
    print('Is the employee information for a regular employee' \
          'or Shift Supervisor? ')
    employeeInfo = int(
        input('Enter 1 for Regular Employee or 2 for Supervisor: '))
    if employeeInfo == 1:
        #define variables
        employeeName = ""
        employeeID = ""
        workShift = 0
        payPer = 0.0

        # Get infromation from user
        employeeName = input('Enter employees Name: ')
        employeeID = input('Enter employees ID Number: ')
        workShift = float(input('Which shift is employee working: '))
        payPer = float(input('Enter employees hourly pay rate: '))

        # create a object for workerInfo
        worker = employee.Worker(employeeName, employeeID, workShift, payPer)
        #display all information that has been store
        print('Here is the information on your Production Worker')
        print('Name: ', employeeName)
        print('ID Number: ', employeeID)
        print('Shift: ', workShift)
        print('Their Hourly Rate of Pay: ', payPer)

    elif employeeInfo == 2:
        #define variables
        employeeName = ""
        employeeID = ""
        annualSalary = ""
        makeBonus = ""
        bonus = 1000.00
        salary = 0.0

        # Get Information from user
        employeeName = input('Enter employees name: ')
        employeeID = input('Enter employee ID number: ')
        annualSalary = float(input('What is their annual salary: '))
        makeBonus = input(
            'Did the supervisors department make annual production levels? yes or no: '
        )
        if makeBonus == 'yes':

            print('Their bonus will be: ', bonus)
            salary = annualSalary + bonus
            print('Their total salary for this year is: ',
                  format(salary, '.2f'))
        else:
            print('They will not recieve a bonus this year')
        # create a object for ShiftSupervisor
        shiftSupervisor = employee.ShiftSupervisor(employeeName, employeeID,
                                                   annualSalary, makeBonus,
                                                   bonus)
        print('--------------------')
        print('Here is the information for the Shift Supervisor.')
        print('Name: ', employeeName)
        print('ID Number: ', employeeID)
        print('Their Annual Salary for this year is: ', salary)

    else:
        print('Please enter a number of 1 or 2.')