#!/usr/bin/python3
#======================================================================================
# The user program (class) - 
# Creating objects of the subclasses (Employee, FullTimer and PartTimer)
#======================================================================================
import sys                                              
sys.path.insert(0,'/home/s/sultans/web/python/demo/oo/extend')
from Employee  import Employee
from FullTimer import FullTimer
from PartTimer import PartTimer

class EmployeeUse:

    print("Content-type: text/html \n")                 #required HTTP response header

    e0 = Employee("Pres","Obama","Barak","M",50)  

    e1 = FullTimer("Dir","Sultan","Sam","M",48,45000,12)  
    e2 = FullTimer("Mgr","Smith","Mary","F",35,40000,12)  
    e3 = FullTimer("Sec","Stevens","Bob","M",28,35000,10)

    e4 = PartTimer("NE","Williams","Bill","M",45,30,25)  
    e5 = PartTimer("NE","Johnson","Joan","F",32,25,22) 
                                               
    print(Employee.getCompanyName())                    #access it thru Employee
    print(FullTimer.getCompanyName())                   #or FullTimer or PartTimer
    print(PartTimer.getCompanyName())                   #(companyName is inherited)
                                                   
    count = Employee.getEmployeeCount()                 #You can call this method
    print("Number employees:" , count)                  #on the Employee class

    count = FullTimer.getEmployeeCount()                #or you can also call it
    print("Number employees:" , count);                 #on the FullTimer class
    count = PartTimer.getEmployeeCount()                #or the PartTimer class    
    print("Number employees:" , count)                  #(method is inherited)

    print(e0.getFullname())                             #getFullname() method
    print(e1.getFullname())                             #is inherited from 
    print(e2.getFullname())                             #the Employee class
    print(e3.getFullname())                             #to Fulltimer class,
    print(e4.getFullname())                             #and PartTimer class.
    print(e5.getFullname())                             #but it is overwritten 
                                                        #in the FullTimer class
    print()
    print(e0)                                           #call the __str__()  
    print(e1 , "\n" , e2 , "\n" , e3)                     
    print(e4 , "\n" , e5)                               
    print()                                    
                                               
                                               

                                               
#=== link to see the python code =================================================
import os, sys
sys.path.insert(0,'/home/s/sultans/web/python/demo')
import zCode                          #import func to display the Python code
filename = os.path.abspath(__file__)  #get absolute file name 
zCode.display(filename)               #call it
#=================================================================================