Skip to content

Megraohoh/classes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NSS Exercise: Classes

Description:

Work with classes in Python

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.

How to run in terminal (Python3 used):

git clone https://github.com/Megraohoh/classes
cd employees.py
python employees.py

Contributors:

Meghan Debity

About

NSS Python3 exercise

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages