Skip to main content

Managing Employee details

Project description

This is a very simple Employee data manager

class Employee:

    num_of_emps = 0
    raise_amt = 1.04

    def __init__(self, first, last, pay):
        self.first = first
        self.last = last
        self.email = first + '.' + last + '@DataSocle.ai'
        self.pay = pay

        Employee.num_of_emps += 1

    def fullname(self):
        return '{} {}'.format(self.first, self.last)

    def apply_raise(self):
        self.pay = int(self.pay * self.raise_amt)

    def details(self):
        return '{} {} {} {}'.format(self.first, self.last, self.email, self.pay)

    def __str__(self):
        return '{} {} - {} - {}'.format(self.first, self.last, self.email,  self.pay)

    @classmethod
    def set_raise_amt(cls, amount):
        cls.raise_amt = amount

    @classmethod
    def from_string(cls, emp_str):
        first, last, pay = emp_str.split('-')
        return cls(first, last, pay)
'''
class Company(Employee):
    def __init__(self, first, last, pay, company):
        super().__init__(first, last, pay)
        self.company = company
        pass
'''
class Manager(Employee):

    def __init__(self, first, last, pay, employees = None):    #Creating List of employees
        super().__init__(first, last, pay)
        if employees is None:
            self.employees = []
        else:
            self.employees = employees

    def add_emp(self, emp):
        if emp in self.employees:
            self.employees.append(emp)

    def remove_emp(self, emp):
        if emp in self.employees:
            self.employees.remove(emp)

    def print_emps(self):
        print("Here the list of Employees under Manager - {} {}".format(self.first, self.last))
        for emp in self.employees:
            print('-->',emp.fullname())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

Employee-0.0.4-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file Employee-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: Employee-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for Employee-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1a9fadf80beb93ee9fe09c35ffad47a0577b109a591a22383da9573e733ff884
MD5 228381139c5bc81a4afcb6061d2ecefb
BLAKE2b-256 926dcda03801e11b5430550a8df36b072fe23dd86ee44cbf1a16f3067408a84e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page