/python-classes-exercise

Python practice exercise involving classes, instance, and aggregation.

Primary LanguagePython

python-classes-exercise

liveCodeExample.py is a code-along in class exercise introduction to classes in python

employees.py is the following exercise

Python practice exercise involving classes, instance, and aggregation.

Instructions

  1. Create a class that contains information about employees of a company and define methods to get/set employee name, job title, and start date.

  2. Copy this Company class into your module.

    class Company(object):
        """This represents a company in which people work"""
    
        def __init__(self, company_name, date_founded):
            self.company_name = company_name
            self.date_founded = date_founded
    
        def get_company_name(self):
            """Returns the name of the company"""
    
            return self.company_name
    
        # Add the remaining methods to fill the requirements above
    
  3. Consider the concept of aggregation, and modify the Company class so that you assign employees to a company.

  4. Create a company, and three employees, and then assign the employees to the company.