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.
-
Create a class that contains information about employees of a company and define methods to get/set employee name, job title, and start date.
-
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
-
Consider the concept of aggregation, and modify the
Company
class so that you assign employees to a company. -
Create a company, and three employees, and then assign the employees to the company.